Skip to content

Commit

Permalink
Updated gem version
Browse files Browse the repository at this point in the history
Updated tests for sprockets v3.2.0
  • Loading branch information
bdrazhzhov committed Jul 6, 2015
1 parent c9400e9 commit 1a9ce67
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.6.0 2015-07-06 22:36:25+0300

* Updated version to 0.6.0 for using Typescript source 1.4.1.3

## v0.5.0 2015-03-25 10:46:29+0900

* Expire root TS cache in response to change in referenced `.ts` files (#24)
Expand Down
9 changes: 2 additions & 7 deletions lib/typescript/rails/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ def replace_relative_references(ts_path, source)

# Why don't we just use gsub? Because it display odd behavior with File.join on Ruby 2.0
# So we go the long way around.
output = (source.each_line.map do |l|
(source.each_line.map do |l|
if l.starts_with?('///') && !(m = %r!^///\s*<reference\s+path=(?:"([^"]+)"|'([^']+)')\s*/>\s*!.match(l)).nil?
matched_path = m.captures.compact[0]
l = l.sub(matched_path, File.join(escaped_dir, matched_path))
end
next l
end).join

output
end

# Get all references
Expand Down Expand Up @@ -64,8 +62,5 @@ def compile(ts_path, source, context=nil, *options)

end

self.default_options = [
'--target', 'ES5',
'--noImplicitAny'
]
self.default_options = %w(--target ES5 --noImplicitAny)
end
2 changes: 1 addition & 1 deletion lib/typescript/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Typescript
module Rails
VERSION = '0.5.0'
VERSION = '0.6.0'
end
end
14 changes: 7 additions & 7 deletions test/assets_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'test_helper'
require File.join(File.dirname(__FILE__), 'test_helper.rb')
require 'typescript-rails'

require "action_controller/railtie"
Expand Down Expand Up @@ -35,14 +35,14 @@ def assets
@app.assets
end

test "typescript.js is included in Sprockets environment" do
assert { assets["typescript"].pathname.to_s.end_with?('/lib/assets/javascripts/typescript.js.erb') }
assert { assets["typescript"].body.include?('var TypeScript') }
test 'typescript.js is included in Sprockets environment' do
assert { assets["typescript"].filename.to_s.end_with?('/lib/assets/javascripts/typescript.js.erb') }
assert { assets["typescript"].source.include?('var ts;') }
end

test "assets .js.ts is compiled from TypeScript to JavaScript" do
test 'assets .js.ts is compiled from TypeScript to JavaScript' do
assert { assets["javascripts/hello"].present? }
assert { assets["javascripts/hello"].send(:dependency_paths).map(&:pathname).map(&:to_s).include? File.expand_path("#{File.dirname(__FILE__)}/fixtures/assets/javascripts/included.ts") }
assert { assets["javascripts/hello"].body.include?('var s = "Hello, world!";') }
assert { assets["javascripts/hello"].source.include?('var log_to_console = function (x) {') }
assert { assets["javascripts/hello"].source.include?('var s = "Hello, world!";') }
end
end
14 changes: 7 additions & 7 deletions typescript-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'typescript/rails/version'

Gem::Specification.new do |gem|
gem.name = "typescript-rails"
gem.name = 'typescript-rails'
gem.version = Typescript::Rails::VERSION
gem.platform = Gem::Platform::RUBY
gem.authors = ["FUJI, Goro", "Klaus Zanders"]
gem.email = ["gfuji@cpan.org", "klaus.zanders@gmail.com"]
gem.authors = ['FUJI, Goro', 'Klaus Zanders']
gem.email = %w(gfuji@cpan.org klaus.zanders@gmail.com)
gem.description = %q{Adds Typescript to the Rails Asset pipeline}
gem.summary = %q{Adds Typescript to the Rails Asset pipeline}
gem.homepage = "https://github.com/typescript-ruby/typescript-rails"
gem.homepage = 'https://github.com/typescript-ruby/typescript-rails'

gem.add_runtime_dependency 'typescript-node', '>= 1.1.0'
gem.add_runtime_dependency 'typescript-node', '>= 1.4.1'
gem.add_runtime_dependency 'tilt'
gem.add_runtime_dependency 'railties'

gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
gem.require_paths = ['lib']

gem.required_ruby_version = ">= 2.0.0"
gem.required_ruby_version = '>= 2.0.0'
end

0 comments on commit 1a9ce67

Please sign in to comment.