typescript-rails 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/typescript/rails/compiler.rb +5 -1
- data/lib/typescript/rails/version.rb +1 -1
- data/test/assets_test.rb +6 -6
- data/test/template_handler_test.rb +10 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12b34eef815a13faa19f11068207bde9a2f20666
|
4
|
+
data.tar.gz: d3dc1fe08e816f00076ae45a74f5d43cee3bddef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d0f7f40795925464b174f2aa2b504b81bf6ff10edec21b71197ed19d47e0375ef3bd11fccea9a63e81991c9062306e135d9847d201e9fce07aa5ca8d5f67f5d
|
7
|
+
data.tar.gz: 5356b4cd32b7b496036df786e9170960a12b4c67d2d18c2d29b9d6e2489e660db02369452e8a92df9e7d3387c184f7fd075de1f2eaaae91e6dd3cf5ced3b90dc
|
@@ -57,7 +57,11 @@ module Typescript::Rails::Compiler
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
s = replace_relative_references(ts_path, source)
|
60
|
-
|
60
|
+
begin
|
61
|
+
::TypeScript::Node.compile(s, *default_options, *options)
|
62
|
+
rescue Exception => e
|
63
|
+
raise "Compilation error in file '#{ts_path}':\n#{e.message}"
|
64
|
+
end
|
61
65
|
end
|
62
66
|
|
63
67
|
end
|
data/test/assets_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'test_helper.rb')
|
2
2
|
require 'typescript-rails'
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require 'action_controller/railtie'
|
5
|
+
require 'sprockets/railtie'
|
6
6
|
|
7
7
|
|
8
8
|
class AssetsTest < ActiveSupport::TestCase
|
@@ -19,7 +19,7 @@ class AssetsTest < ActiveSupport::TestCase
|
|
19
19
|
env.cache = ActiveSupport::Cache.lookup_store(:memory_store)
|
20
20
|
end
|
21
21
|
@app.config.assets.paths << "#{File.dirname(__FILE__)}/fixtures/assets"
|
22
|
-
@app.paths[
|
22
|
+
@app.paths['log'] = "#{tmp_path}/log/test.log"
|
23
23
|
@app.initialize!
|
24
24
|
end
|
25
25
|
|
@@ -41,8 +41,8 @@ class AssetsTest < ActiveSupport::TestCase
|
|
41
41
|
end
|
42
42
|
|
43
43
|
test 'assets .js.ts is compiled from TypeScript to JavaScript' do
|
44
|
-
assert { assets[
|
45
|
-
assert { assets[
|
46
|
-
assert { assets[
|
44
|
+
assert { assets['javascripts/hello'].present? }
|
45
|
+
assert { assets['javascripts/hello'].source.include?('var log_to_console = function (x) {') }
|
46
|
+
assert { assets['javascripts/hello'].source.include?('var s = "Hello, world!";') }
|
47
47
|
end
|
48
48
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'test_helper'
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper.rb')
|
2
2
|
require 'action_controller'
|
3
3
|
require 'typescript-rails'
|
4
4
|
|
5
5
|
class SiteController < ActionController::Base
|
6
|
-
self.view_paths = File.expand_path(
|
6
|
+
self.view_paths = File.expand_path('../fixtures', __FILE__)
|
7
7
|
end
|
8
8
|
|
9
9
|
DummyApp = ActionDispatch::Routing::RouteSet.new
|
@@ -29,26 +29,26 @@ class TemplateHandlerTest < ActiveSupport::TestCase
|
|
29
29
|
last_response.body.gsub(%r{^//[^\n]*}m, '')
|
30
30
|
end
|
31
31
|
|
32
|
-
test
|
33
|
-
get
|
32
|
+
test 'typescript views are served as javascript' do
|
33
|
+
get '/site/index.js'
|
34
34
|
assert_match /var x = 5;\s*/,
|
35
35
|
source
|
36
36
|
end
|
37
37
|
|
38
|
-
test
|
39
|
-
get
|
38
|
+
test '<reference> to other .ts file works' do
|
39
|
+
get '/site/ref1_2.js'
|
40
40
|
assert_match /var f = function \(x, y\) \{\s*return x \+ y;\s*\};\s*f\(1, 2\);\s*/,
|
41
41
|
source
|
42
42
|
end
|
43
43
|
|
44
|
-
test
|
45
|
-
get
|
44
|
+
test '<reference> to other .d.ts file works' do
|
45
|
+
get '/site/ref2_2.js'
|
46
46
|
assert_match /f\(1, 2\);\s*/,
|
47
47
|
source
|
48
48
|
end
|
49
49
|
|
50
|
-
test
|
51
|
-
get
|
50
|
+
test '<reference> to multiple .ts files works' do
|
51
|
+
get '/site/ref3_1.js'
|
52
52
|
assert_match /var f1 = function \(\) \{\s*\};\s*var f2 = function \(\) \{\s*\};\s*f1\(\);\s*f2\(\);/,
|
53
53
|
source
|
54
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typescript-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FUJI, Goro
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typescript-node
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.0.15
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Adds Typescript to the Rails Asset pipeline
|