typescript-rails 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +2 -2
- data/Rakefile +3 -1
- data/lib/typescript-rails.rb +4 -6
- data/lib/typescript/rails/template_handler.rb +7 -4
- data/lib/typescript/rails/version.rb +1 -1
- data/test/support/site/es5.js.ts +7 -0
- data/test/template_handler_test.rb +11 -6
- data/typescript-rails.gemspec +2 -4
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d275ff8fd90b13580de3f11a3798e0cbd9aec47c
|
4
|
+
data.tar.gz: 2942656ec7afda0c974fb05f3300058747862e58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55f7d3ee2d3e65b07e65fa0e3c7d2a742abbff70679eb00cd3d20c9267532be40d4909b9883d10d905b0f081afca82cb8c1678ad918142be74322813abfb4530
|
7
|
+
data.tar.gz: bee501dd861c693c090563015b480e5aac5d161390c301a742b26fde02ed96d1dbd5269e24228dae9a807d3a7d58828906b78ab05919d687ab7517dec2b1a7f6
|
data/CHANGES.md
ADDED
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# TypeScript for Rails [![Build Status](https://travis-ci.org/typescript-
|
1
|
+
# TypeScript for Rails [![Build Status](https://travis-ci.org/typescript-ruby/typescript-rails.svg?branch=master)](https://travis-ci.org/typescript-ruby/typescript-rails)
|
2
2
|
|
3
3
|
This is a wrapper for the [TypeScript](http://www.typescriptlang.org/) JavaScript superset language by Microsoft.
|
4
4
|
|
5
5
|
It enables you to use the `.ts` extension in the Asset Pipeline and also in ActionView Templates.
|
6
6
|
|
7
7
|
This gem uses the
|
8
|
-
[typescript-node-ruby](https://github.com/
|
8
|
+
[typescript-node-ruby](https://github.com/typescript-ruby/typescript-node-ruby)
|
9
9
|
library by KAWACHI Takashi for the typescript parsing with node js.
|
10
10
|
|
11
11
|
The credit for the overall structure and the tests goes to the people that wrote the [coffee-rails](https://github.com/rails/coffee-rails) Gem, since I shamelessly copy&pasted some of their code.
|
data/Rakefile
CHANGED
data/lib/typescript-rails.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require "typescript/rails/template_handler"
|
6
|
-
require "typescript/rails/version"
|
1
|
+
require 'typescript/rails/railtie'
|
2
|
+
require 'typescript/rails/engine'
|
3
|
+
require 'typescript/rails/template_handler'
|
4
|
+
require 'typescript/rails/version'
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'typescript-node'
|
1
2
|
require 'tilt'
|
2
3
|
|
3
4
|
module Typescript
|
@@ -16,12 +17,12 @@ module Typescript
|
|
16
17
|
@@default_bare = value
|
17
18
|
end
|
18
19
|
|
19
|
-
#
|
20
|
+
# @deprecated
|
20
21
|
def self.default_no_wrap
|
21
22
|
@@default_bare
|
22
23
|
end
|
23
24
|
|
24
|
-
#
|
25
|
+
# @deprecated
|
25
26
|
def self.default_no_wrap=(value)
|
26
27
|
@@default_bare = value
|
27
28
|
end
|
@@ -42,7 +43,8 @@ module Typescript
|
|
42
43
|
|
43
44
|
def evaluate(scope, locals, &block)
|
44
45
|
source = Typescript::Rails.replace_relative_references(file, data)
|
45
|
-
|
46
|
+
# TODO: employs source-maps
|
47
|
+
@output ||= TypeScript::Node.compile(source, '--target', 'ES5')
|
46
48
|
end
|
47
49
|
|
48
50
|
def allows_script?
|
@@ -63,7 +65,8 @@ module Typescript
|
|
63
65
|
TypeScript::Node.compile(
|
64
66
|
Typescript::Rails.replace_relative_references(
|
65
67
|
'#{escaped_path}', (begin;#{compiled_source};end)
|
66
|
-
)
|
68
|
+
),
|
69
|
+
'--target', 'ES5'
|
67
70
|
)
|
68
71
|
EOS
|
69
72
|
end
|
@@ -8,12 +8,13 @@ end
|
|
8
8
|
|
9
9
|
DummyApp = ActionDispatch::Routing::RouteSet.new
|
10
10
|
DummyApp.draw do
|
11
|
-
get
|
12
|
-
get
|
13
|
-
get
|
14
|
-
get
|
15
|
-
get
|
16
|
-
get
|
11
|
+
get 'site/index'
|
12
|
+
get 'site/ref1_1'
|
13
|
+
get 'site/ref1_2'
|
14
|
+
get 'site/ref2_1'
|
15
|
+
get 'site/ref2_2'
|
16
|
+
get 'site/ref3_1'
|
17
|
+
get 'site/es5'
|
17
18
|
end
|
18
19
|
|
19
20
|
class TemplateHandlerTest < ActiveSupport::TestCase
|
@@ -52,4 +53,8 @@ class TemplateHandlerTest < ActiveSupport::TestCase
|
|
52
53
|
source
|
53
54
|
end
|
54
55
|
|
56
|
+
test 'ES5 features' do
|
57
|
+
get '/site/es5.js'
|
58
|
+
assert_equal 200, last_response.status
|
59
|
+
end
|
55
60
|
end
|
data/typescript-rails.gemspec
CHANGED
@@ -12,11 +12,9 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.email = ["gfuji@cpan.org", "klaus.zanders@gmail.com"]
|
13
13
|
gem.description = %q{Adds Typescript to the Rails Asset pipeline}
|
14
14
|
gem.summary = %q{Adds Typescript to the Rails Asset pipeline}
|
15
|
-
gem.homepage = "https://github.com/typescript-
|
15
|
+
gem.homepage = "https://github.com/typescript-ruby/typescript-rails"
|
16
16
|
|
17
|
-
gem.
|
18
|
-
|
19
|
-
gem.add_runtime_dependency 'typescript-node'
|
17
|
+
gem.add_runtime_dependency 'typescript-node', '>= 1.1.0'
|
20
18
|
gem.add_runtime_dependency 'tilt'
|
21
19
|
gem.add_runtime_dependency 'railties'
|
22
20
|
|
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.
|
4
|
+
version: 0.3.0
|
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: 2014-
|
12
|
+
date: 2014-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typescript-node
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 1.1.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 1.1.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: tilt
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,6 +63,7 @@ extra_rdoc_files: []
|
|
63
63
|
files:
|
64
64
|
- ".gitignore"
|
65
65
|
- ".travis.yml"
|
66
|
+
- CHANGES.md
|
66
67
|
- Gemfile
|
67
68
|
- LICENSE.txt
|
68
69
|
- README.md
|
@@ -75,6 +76,7 @@ files:
|
|
75
76
|
- lib/typescript/rails/version.rb
|
76
77
|
- test/assets_test.rb
|
77
78
|
- test/support/routes.rb
|
79
|
+
- test/support/site/es5.js.ts
|
78
80
|
- test/support/site/index.js.ts
|
79
81
|
- test/support/site/ref1_1.js.ts
|
80
82
|
- test/support/site/ref1_2.js.ts
|
@@ -86,7 +88,7 @@ files:
|
|
86
88
|
- test/template_handler_test.rb
|
87
89
|
- test/test_helper.rb
|
88
90
|
- typescript-rails.gemspec
|
89
|
-
homepage: https://github.com/typescript-
|
91
|
+
homepage: https://github.com/typescript-ruby/typescript-rails
|
90
92
|
licenses: []
|
91
93
|
metadata: {}
|
92
94
|
post_install_message:
|
@@ -104,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
106
|
- !ruby/object:Gem::Version
|
105
107
|
version: '0'
|
106
108
|
requirements: []
|
107
|
-
rubyforge_project:
|
109
|
+
rubyforge_project:
|
108
110
|
rubygems_version: 2.2.2
|
109
111
|
signing_key:
|
110
112
|
specification_version: 4
|
@@ -112,6 +114,7 @@ summary: Adds Typescript to the Rails Asset pipeline
|
|
112
114
|
test_files:
|
113
115
|
- test/assets_test.rb
|
114
116
|
- test/support/routes.rb
|
117
|
+
- test/support/site/es5.js.ts
|
115
118
|
- test/support/site/index.js.ts
|
116
119
|
- test/support/site/ref1_1.js.ts
|
117
120
|
- test/support/site/ref1_2.js.ts
|