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.6.2.0'
Class Attribute Summary collapse
-
.use_external_tsc ⇒ Object
Returns the value of attribute use_external_tsc.
Class Method Summary collapse
- .js_content ⇒ String
- .js_path ⇒ Pathname
- .license_path ⇒ Pathname
- .package_info ⇒ Hash
- .package_json_path ⇒ Pathname
- .tsc_path ⇒ Pathname
- .typescript_path ⇒ Pathname
- .version ⇒ String
Class Attribute Details
.use_external_tsc ⇒ Object
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_content ⇒ String
51 52 53 |
# File 'lib/typescript-src.rb', line 51 def js_content js_path.read end |
.js_path ⇒ Pathname
29 30 31 32 33 34 35 36 |
# File 'lib/typescript-src.rb', line 29 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_path ⇒ Pathname
44 45 46 |
# File 'lib/typescript-src.rb', line 44 def license_path typescript_path.join('LICENSE.txt') end |
.package_info ⇒ Hash
56 57 58 |
# File 'lib/typescript-src.rb', line 56 def package_info JSON.parse(package_json_path.read) end |
.package_json_path ⇒ Pathname
39 40 41 |
# File 'lib/typescript-src.rb', line 39 def package_json_path typescript_path.join('package.json') end |
.tsc_path ⇒ Pathname
24 25 26 |
# File 'lib/typescript-src.rb', line 24 def tsc_path typescript_path.join('bin/tsc') end |
.typescript_path ⇒ 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 |
.version ⇒ String
61 62 63 |
# File 'lib/typescript-src.rb', line 61 def version package_info['version'] end |