Module: TypeScript::Src

Defined in:
lib/typescript-src.rb,
lib/typescript-src/version.rb

Constant Summary collapse

VERSION =

TypeScript compiler version + gem’s revision

'1.4.1.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.use_external_tscObject

Returns the value of attribute use_external_tsc.



8
9
10
# File 'lib/typescript-src.rb', line 8

def use_external_tsc
  @use_external_tsc
end

Class Method Details

.js_contentString

Returns:

  • (String)


46
47
48
# File 'lib/typescript-src.rb', line 46

def js_content
  js_path.read
end

.js_pathPathname

Returns:

  • (Pathname)


29
30
31
# File 'lib/typescript-src.rb', line 29

def js_path
  typescript_path.join('bin/tsc.js')
end

.license_pathPathname

Returns:

  • (Pathname)


39
40
41
# File 'lib/typescript-src.rb', line 39

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

.package_infoHash

Returns:

  • (Hash)


51
52
53
# File 'lib/typescript-src.rb', line 51

def package_info
  JSON.parse(package_json_path.read)
end

.package_json_pathPathname

Returns:

  • (Pathname)


34
35
36
# File 'lib/typescript-src.rb', line 34

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

.tsc_pathPathname

Returns:

  • (Pathname)


24
25
26
# File 'lib/typescript-src.rb', line 24

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

.typescript_pathPathname

Returns:

  • (Pathname)


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/typescript-src.rb', line 11

def typescript_path
  unless @typescript_path
    if self.use_external_tsc
      @typescript_path = ::Pathname.new(`npm root -g`.strip! + '/typescript')
    else
      @typescript_path = ::Pathname.new(File.dirname(__FILE__)).join('typescript-src/support/typescript')
    end
  end

  @typescript_path
end

.versionString

Returns:

  • (String)


56
57
58
# File 'lib/typescript-src.rb', line 56

def version
  package_info['version']
end