coffee-views 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,14 +5,21 @@ ActiveSupport.on_load(:action_view) do
5
5
  module CoffeeViews
6
6
  class CoffeeViewEngine < Slim::EmbeddedEngine::ERBEngine
7
7
  def on_slim_embedded(engine, body)
8
- source = CoffeeViews::Rails::TemplateHandler.compile_coffee(collect_text(body))
9
- [:multi, [:newline], Temple::ERB::Parser.new.call(source)]
8
+ erb = collect_text(body)
9
+ source = CoffeeViews::Rails::TemplateHandler.compile_coffee(erb)
10
+ [:multi, [:newline], erb_parser.call(source)]
11
+ end
12
+
13
+ def erb_parser
14
+ @erb_parser ||= Temple::ERB::Parser.new
10
15
  end
11
16
 
12
17
  protected
13
18
 
14
- def collect_text(body)
15
- ::Slim::CollectText.new.call(body)
19
+ if !::Slim.const_defined?(:TextCollector)
20
+ def collect_text(body)
21
+ ::Slim::CollectText.new.call(body)
22
+ end
16
23
  end
17
24
  end
18
25
 
@@ -1,3 +1,3 @@
1
1
  module CoffeeViews
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "events/index.js.coffee" do
3
+ describe "events/index.js" do
4
4
  it "interpolates strings" do
5
5
  assign :first_name, "Yury"
6
6
  assign :last_name, "'Korolev'"
@@ -9,22 +9,26 @@ describe "events/index.js.coffee" do
9
9
 
10
10
  rendered.should == <<-JAVASCRIPT
11
11
  (function() {
12
+
12
13
  alert("hello, " + "Yury" + " " + 'Korolev');
14
+
13
15
  }).call(this);
14
16
  JAVASCRIPT
15
17
  end
16
18
  end
17
19
 
18
- describe "events/index.html.slim" do
20
+ describe "events/index.html" do
19
21
  it "adds embeded engine for slim" do
20
22
  assign :first_name, "Yury"
21
23
  assign :last_name, "'Korolev'"
22
24
 
23
- render
25
+ render
24
26
 
25
27
  expected = <<-JAVASCRIPT
26
28
  <script type="text/javascript">(function() {
29
+
27
30
  alert("hello, " + "Yury" + " " + 'Korolev');
31
+
28
32
  }).call(this);
29
33
  </script>
30
34
  JAVASCRIPT
@@ -33,7 +37,7 @@ JAVASCRIPT
33
37
  end
34
38
  end
35
39
 
36
- describe "events/show.js.coffee" do
40
+ describe "events/show.js" do
37
41
  it "converts to json" do
38
42
  assign :event, {name: "Birth day", date: Date.new(1983, 02, 15)}
39
43
 
@@ -42,8 +46,11 @@ describe "events/show.js.coffee" do
42
46
  rendered.should == <<-JAVASCRIPT
43
47
  (function() {
44
48
  var event, owner_id;
49
+
45
50
  event = {"name":"Birth day","date":"1983-02-15"};
51
+
46
52
  owner_id = 100;
53
+
47
54
  }).call(this);
48
55
  JAVASCRIPT
49
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coffee-views
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-06 00:00:00.000000000 Z
12
+ date: 2012-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70113806209320 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70113806209320
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: coffee-rails
27
- requirement: &70113806222720 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70113806222720
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: sqlite3
38
- requirement: &70113806220560 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70113806220560
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rspec-rails
49
- requirement: &70113806217600 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '2.6'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70113806217600
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '2.6'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: sass-rails
60
- requirement: &70113806215340 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70113806215340
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: coffee-rails
71
- requirement: &70113806228380 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70113806228380
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: uglifier
82
- requirement: &70113806227060 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70113806227060
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: slim
93
- requirement: &70113806225100 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ! '>='
@@ -98,7 +133,12 @@ dependencies:
98
133
  version: '0'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *70113806225100
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
102
142
  description: Allows you to create .js.coffee views
103
143
  email: yury.korolev@gmail.com
104
144
  executables: []
@@ -175,8 +215,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
215
  version: '0'
176
216
  requirements: []
177
217
  rubyforge_project:
178
- rubygems_version: 1.8.10
218
+ rubygems_version: 1.8.24
179
219
  signing_key:
180
220
  specification_version: 3
181
221
  summary: CoffeeScript views in rails 3
182
222
  test_files: []
223
+ has_rdoc: