Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using local TS node module #6

Merged
merged 3 commits into from
Jul 6, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/typescript-src.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ module Src
class << self
# @return [Pathname]
def typescript_path
@typescript_path ||= ::Pathname.new(File.dirname(__FILE__)).join('typescript-src/support/typescript')
unless @typescript_path
begin
@typescript_path = ::Pathname.new(`npm root -g`.strip! + '/typescript')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't throw an exception even if the directory doesn't exist.

rescue
@typescript_path = ::Pathname.new(File.dirname(__FILE__)).join('typescript-src/support/typescript')
end
end

@typescript_path
end

# @return [Pathname]
Expand All @@ -17,7 +25,7 @@ def tsc_path

# @return [Pathname]
def js_path
typescript_path.join('bin/typescript.js')
typescript_path.join('bin/tsc.js')
end

# @return [Pathname]
Expand Down
2 changes: 1 addition & 1 deletion lib/typescript-src/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module TypeScript
module Src
VERSION = '1.0.1.2' # TypeScript compiler version + gem's revision
VERSION = '1.0.1.3' # TypeScript compiler version + gem's revision
end
end