Module: TypeScript::Src

Defined in:
lib/tsrc.rb,
lib/tsrc/version.rb

Constant Summary collapse

VERSION =

TypeScript compiler version + Gem revision

'2.1.5.0'

Class Method Summary collapse

Class Method Details

.js_contentString

Returns:

  • (String)


41
42
43
# File 'lib/tsrc.rb', line 41

def js_content
  js_path.read
end

.js_pathPathname

Returns:

  • (Pathname)


19
20
21
22
23
24
25
26
# File 'lib/tsrc.rb', line 19

def js_path
  bin_tsc = typescript_path.join('lib/tsc.js')
  if ::File.exist?(bin_tsc)
    bin_tsc
  else
    typescript_path.join('bin/tsc.js')
  end
end

.license_pathPathname

Returns:

  • (Pathname)


34
35
36
# File 'lib/tsrc.rb', line 34

def license_path
  typescript_path.join('LICENSE.txt')
end

.package_infoHash

Returns:

  • (Hash)


46
47
48
# File 'lib/tsrc.rb', line 46

def package_info
  JSON.parse(package_json_path.read)
end

.package_json_pathPathname

Returns:

  • (Pathname)


29
30
31
# File 'lib/tsrc.rb', line 29

def package_json_path
  typescript_path.join('package.json')
end

.tsc_pathPathname

Returns:

  • (Pathname)


14
15
16
# File 'lib/tsrc.rb', line 14

def tsc_path
  typescript_path.join('bin/tsc')
end

.typescript_pathPathname

Returns:

  • (Pathname)


9
10
11
# File 'lib/tsrc.rb', line 9

def typescript_path
  @typescript_path ||= ::Pathname.new(File.dirname(__FILE__)).join('tsrc/support/typescript')
end

.versionString

Returns:

  • (String)


51
52
53
# File 'lib/tsrc.rb', line 51

def version
  package_info['version']
end