cells-erb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Appraisals +7 -7
- data/README.md +5 -17
- data/cells-erb.gemspec +14 -11
- data/gemfiles/rails_4.2-tilt-1.4.gemfile +15 -0
- data/gemfiles/rails_4.2-tilt-2.0.gemfile +13 -0
- data/gemfiles/rails_4.2-tilt-3.0.gemfile +13 -0
- data/lib/cell/erb/template.rb +30 -0
- data/lib/cell/erb/version.rb +5 -0
- data/lib/cells-erb.rb +1 -0
- data/test/dummy/app/cells/song/with_content_tag.erb +1 -6
- data/test/dummy/app/cells/song/with_content_tag_and_content_tag.erb +6 -0
- data/test/dummy/app/cells/song/with_form_tag_and_content_tag.erb +12 -0
- data/test/dummy/app/cells/song_cell.rb +9 -1
- data/test/erb_test.rb +33 -5
- data/test/test_helper.rb +5 -7
- metadata +48 -24
- data/gemfiles/rails_3.2.gemfile +0 -16
- data/gemfiles/rails_4.0.gemfile +0 -16
- data/gemfiles/rails_4.1.gemfile +0 -16
- data/gemfiles/rails_4.2.gemfile +0 -16
- data/lib/cell/erb.rb +0 -72
- data/lib/cells/erb.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15a81cb8e550deade32a9dd5311062296927e306
|
4
|
+
data.tar.gz: ecbea4577de1b3059769b6d56cae6ded988eebfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 553a21f3119347d5be6e0e18fd7e30d8b7cc8344cfe5f22c2ded2a9d21b86ebbfd536567d8384627997d9915b422c3b3b2515f52851b4998da57f92956144efa
|
7
|
+
data.tar.gz: 15322a3fe3e5dcc825723fc06806577d591f1657972117cc09053b06a1d002963dd47ac77b4c06b294899499d48d881861a4d34d835c3dc0ea5c242e84dd399a
|
data/.travis.yml
ADDED
data/Appraisals
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
appraise 'rails-3.2' do
|
2
|
-
gem 'railties',
|
2
|
+
gem 'railties', '~> 3.2'
|
3
3
|
gem 'tzinfo'
|
4
4
|
gem 'minitest', '4.7.5'
|
5
5
|
end
|
6
6
|
|
7
7
|
appraise "rails-4.0" do
|
8
|
-
gem 'railties',
|
9
|
-
gem 'activemodel'
|
8
|
+
gem 'railties', '~> 4.0.0'
|
9
|
+
gem 'activemodel'
|
10
10
|
gem 'minitest', '4.7.5'
|
11
11
|
end
|
12
12
|
|
13
13
|
appraise "rails-4.1" do
|
14
|
-
gem 'railties',
|
15
|
-
gem 'activemodel'
|
14
|
+
gem 'railties', '~> 4.1.0'
|
15
|
+
gem 'activemodel'
|
16
16
|
gem 'minitest', '~> 5.2'
|
17
17
|
end
|
18
18
|
|
19
19
|
appraise "rails-4.2" do
|
20
|
-
gem 'railties',
|
21
|
-
gem 'activemodel'
|
20
|
+
gem 'railties', '~> 4.2.0'
|
21
|
+
gem 'activemodel'
|
22
22
|
gem 'minitest', '~> 5.2'
|
23
23
|
end
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Cells::Erb
|
2
2
|
|
3
|
-
|
3
|
+
Proper ERB support for Cells using [Erbse](https://github.com/apotonick/erbse).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -10,22 +10,10 @@ Add this line to your application's Gemfile:
|
|
10
10
|
gem 'cells-erb'
|
11
11
|
```
|
12
12
|
|
13
|
-
|
13
|
+
This will register the `Erbse::Template` engine with Tilt for `.erb` files.
|
14
14
|
|
15
|
-
|
15
|
+
And that's all you need to do.
|
16
16
|
|
17
|
-
|
17
|
+
## Dependencies
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
TODO: Write usage instructions here
|
24
|
-
|
25
|
-
## Contributing
|
26
|
-
|
27
|
-
1. Fork it ( https://github.com/trailblazer/cells-erb/fork )
|
28
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
-
5. Create a new Pull Request
|
19
|
+
This gem works with Tilt 1.4 and 2.0, and hence allows you to use it from Rails 3.2 upwards.
|
data/cells-erb.gemspec
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
|
2
|
-
lib
|
3
|
-
|
1
|
+
lib = File.expand_path('../lib/', __FILE__)
|
2
|
+
$:.unshift lib unless $:.include?(lib)
|
3
|
+
|
4
|
+
|
5
|
+
require 'cell/erb/version'
|
4
6
|
|
5
7
|
Gem::Specification.new do |spec|
|
6
8
|
spec.name = 'cells-erb'
|
7
|
-
spec.version =
|
9
|
+
spec.version = Cell::Erb::VERSION
|
8
10
|
spec.authors = ['Abdelkader Boudih','Nick Sutterer']
|
9
11
|
spec.email = %w(terminale@gmail.com apotonick@gmail.com)
|
10
|
-
spec.summary = '
|
11
|
-
spec.description = '
|
12
|
-
'
|
12
|
+
spec.summary = 'Tilt binding for Erbse.'
|
13
|
+
spec.description = 'Tilt binding for Erbse. Erbse is a modern Erubis implementation with block support.'
|
13
14
|
spec.homepage = 'https://github.com/trailblazer/cells-erb'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
|
@@ -17,8 +18,10 @@ Gem::Specification.new do |spec|
|
|
17
18
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
18
19
|
spec.require_paths = ['lib']
|
19
20
|
|
20
|
-
spec.add_runtime_dependency
|
21
|
-
spec.add_runtime_dependency
|
22
|
-
spec.
|
23
|
-
|
21
|
+
spec.add_runtime_dependency "cells", "~> 4.0.0.beta"
|
22
|
+
spec.add_runtime_dependency "tilt", ">= 1.4", "< 3"
|
23
|
+
spec.add_runtime_dependency "erbse", ">= 0.0.2"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "rake"
|
24
27
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "cells", :github => "apotonick/cells"
|
6
|
+
#gem "cells", path: "../../cells"
|
7
|
+
gem "appraisal"
|
8
|
+
gem "railties", "~> 4.2.0"
|
9
|
+
gem "activemodel"
|
10
|
+
gem "minitest", "~> 5.2"
|
11
|
+
gem "tilt", "~> 1.4"
|
12
|
+
|
13
|
+
gemspec :path => "../"
|
14
|
+
|
15
|
+
# gem "erbse", path: "../../erbse"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "cells", :github => "apotonick/cells"
|
6
|
+
#gem "cells", path: "../../cells"
|
7
|
+
gem "appraisal"
|
8
|
+
gem "railties", "~> 4.2.0"
|
9
|
+
gem "activemodel"
|
10
|
+
gem "minitest", "~> 5.2"
|
11
|
+
gem "tilt", "~> 2.0"
|
12
|
+
|
13
|
+
gemspec :path => "../"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "cells", :github => "apotonick/cells"
|
6
|
+
#gem "cells", path: "../../cells"
|
7
|
+
gem "appraisal"
|
8
|
+
gem "railties", "~> 4.2.0"
|
9
|
+
gem "activemodel"
|
10
|
+
gem "minitest", "~> 5.2"
|
11
|
+
gem "tilt", "~> 3.0"
|
12
|
+
|
13
|
+
gemspec :path => "../"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "erbse"
|
2
|
+
|
3
|
+
module Cell::Erb
|
4
|
+
# Erbse-Tilt binding. This should be bundled with tilt. # 1.4. OR should be tilt-erbse.
|
5
|
+
class Template < Tilt::Template
|
6
|
+
def self.engine_initialized?
|
7
|
+
defined? ::Erbse::Template
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize_engine
|
11
|
+
require_template_library 'erbse'
|
12
|
+
end
|
13
|
+
|
14
|
+
# :engine_class can be passed via
|
15
|
+
#
|
16
|
+
# Tilt.new("#{base}/#{prefix}/#{view}", engine_class: Erbse::Eruby)
|
17
|
+
def prepare
|
18
|
+
engine_class = options.delete(:engine_class)
|
19
|
+
# engine_class = ::Erubis::EscapedEruby if options.delete(:escape_html)
|
20
|
+
@template = (engine_class || ::Erbse::Template).new(data, options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def precompiled_template(locals)
|
24
|
+
@template.call
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Tilt.register Cell::Erb::Template, "erb"
|
30
|
+
# Tilt.prefer Cell::Erb::Template
|
data/lib/cells-erb.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "cell/erb/template"
|
data/test/erb_test.rb
CHANGED
@@ -1,16 +1,44 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
|
4
3
|
class ErbTest < MiniTest::Spec
|
5
4
|
let (:controller) { ApplicationController.new.tap { |ctl| ctl.send("request=", ActionDispatch::Request.new({})) } }
|
6
|
-
let (:
|
5
|
+
let (:song_cell) { SongCell.new(controller) }
|
7
6
|
|
8
7
|
|
9
8
|
# URL helpers work in cell instance.
|
10
|
-
it {
|
9
|
+
it { song_cell.songs_path.must_equal "/songs" }
|
10
|
+
|
11
|
+
# content_tag { }
|
12
|
+
it { song_cell.(:with_content_tag).must_equal "<div>Beachparty</div>" }
|
13
|
+
|
14
|
+
# content_tag { content_tag { } }
|
15
|
+
it do song_cell.(:with_content_tag_and_content_tag).must_equal %{<span>
|
16
|
+
Title:
|
17
|
+
<div>
|
18
|
+
Still Knee Deep
|
19
|
+
</div></span>}
|
20
|
+
end
|
21
|
+
|
22
|
+
# form_tag { content_tag { } }
|
23
|
+
it( "xxx") do
|
24
|
+
form_tag = "<form action=\"/erubis/is/horribly/outdated\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" />"
|
25
|
+
form_tag = "<form accept-charset=\"UTF-8\" action=\"/erubis/is/horribly/outdated\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /></div>" if ActionPack::VERSION::MAJOR == 3
|
26
|
+
|
27
|
+
song_cell.(:with_form_tag_and_content_tag).must_equal %{Word.
|
28
|
+
|
29
|
+
#{form_tag}
|
30
|
+
<a href=\"/rails/sucks\">
|
31
|
+
hallo
|
32
|
+
</a>
|
33
|
+
<ul>
|
34
|
+
Hallo
|
35
|
+
</ul>
|
36
|
+
</form>}
|
37
|
+
end
|
38
|
+
# song_cell.(:with_form_tag_and_content_tag).must_equal_xml_structure "<form><div><input/></div><label/><input/><ul><li/></ul></form>" }
|
39
|
+
|
40
|
+
|
11
41
|
|
12
|
-
# content_tag with ERB.
|
13
|
-
it { cellule.with_content_tag.must_equal "<span>Title:\n<div>Still Knee Deep\n</div>\n</span>\n" }
|
14
42
|
#
|
15
43
|
# # form_tag with block in block work.
|
16
44
|
# it { cellule.edit.must_equal "<form><div><input/></div><label/><input/><ul><li/></ul></form>" }
|
data/test/test_helper.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
|
2
|
-
require 'byebug'
|
3
|
-
rescue LoadError
|
4
|
-
end
|
5
|
-
require 'minitest/reporters'
|
6
|
-
Minitest::Reporters.use! [Minitest::Reporters::ProgressReporter.new]
|
1
|
+
require "pp"
|
7
2
|
require 'minitest/autorun'
|
8
3
|
|
9
4
|
ENV['RAILS_ENV'] = 'test'
|
10
5
|
|
11
|
-
|
6
|
+
|
7
|
+
require "cells"
|
12
8
|
require_relative 'dummy/config/environment'
|
9
|
+
|
10
|
+
require "cells-erb"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cells-erb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cells
|
@@ -26,49 +26,69 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 4.0.0.beta
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: tilt
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.4'
|
35
|
+
- - "<"
|
33
36
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
37
|
+
version: '3'
|
35
38
|
type: :runtime
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
|
-
- - "
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '1.4'
|
45
|
+
- - "<"
|
40
46
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
47
|
+
version: '3'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: erbse
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.2
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.2
|
42
62
|
- !ruby/object:Gem::Dependency
|
43
63
|
name: bundler
|
44
64
|
requirement: !ruby/object:Gem::Requirement
|
45
65
|
requirements:
|
46
66
|
- - ">="
|
47
67
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
68
|
+
version: '0'
|
49
69
|
type: :development
|
50
70
|
prerelease: false
|
51
71
|
version_requirements: !ruby/object:Gem::Requirement
|
52
72
|
requirements:
|
53
73
|
- - ">="
|
54
74
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
75
|
+
version: '0'
|
56
76
|
- !ruby/object:Gem::Dependency
|
57
77
|
name: rake
|
58
78
|
requirement: !ruby/object:Gem::Requirement
|
59
79
|
requirements:
|
60
|
-
- - "
|
80
|
+
- - ">="
|
61
81
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
82
|
+
version: '0'
|
63
83
|
type: :development
|
64
84
|
prerelease: false
|
65
85
|
version_requirements: !ruby/object:Gem::Requirement
|
66
86
|
requirements:
|
67
|
-
- - "
|
87
|
+
- - ">="
|
68
88
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
70
|
-
description:
|
71
|
-
|
89
|
+
version: '0'
|
90
|
+
description: Tilt binding for Erbse. Erbse is a modern Erubis implementation with
|
91
|
+
block support.
|
72
92
|
email:
|
73
93
|
- terminale@gmail.com
|
74
94
|
- apotonick@gmail.com
|
@@ -77,21 +97,24 @@ extensions: []
|
|
77
97
|
extra_rdoc_files: []
|
78
98
|
files:
|
79
99
|
- ".gitignore"
|
100
|
+
- ".travis.yml"
|
80
101
|
- Appraisals
|
81
102
|
- Gemfile
|
82
103
|
- LICENSE.txt
|
83
104
|
- README.md
|
84
105
|
- Rakefile
|
85
106
|
- cells-erb.gemspec
|
86
|
-
- gemfiles/
|
87
|
-
- gemfiles/rails_4.0.gemfile
|
88
|
-
- gemfiles/rails_4.
|
89
|
-
-
|
90
|
-
- lib/cell/erb.rb
|
91
|
-
- lib/cells
|
107
|
+
- gemfiles/rails_4.2-tilt-1.4.gemfile
|
108
|
+
- gemfiles/rails_4.2-tilt-2.0.gemfile
|
109
|
+
- gemfiles/rails_4.2-tilt-3.0.gemfile
|
110
|
+
- lib/cell/erb/template.rb
|
111
|
+
- lib/cell/erb/version.rb
|
112
|
+
- lib/cells-erb.rb
|
92
113
|
- test/dummy/Rakefile
|
93
114
|
- test/dummy/app/cells/song/with_content_tag.erb
|
115
|
+
- test/dummy/app/cells/song/with_content_tag_and_content_tag.erb
|
94
116
|
- test/dummy/app/cells/song/with_form_for_block.erb
|
117
|
+
- test/dummy/app/cells/song/with_form_tag_and_content_tag.erb
|
95
118
|
- test/dummy/app/cells/song_cell.rb
|
96
119
|
- test/dummy/app/controllers/application_controller.rb
|
97
120
|
- test/dummy/config.ru
|
@@ -123,14 +146,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
146
|
version: '0'
|
124
147
|
requirements: []
|
125
148
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.2.2
|
127
150
|
signing_key:
|
128
151
|
specification_version: 4
|
129
|
-
summary:
|
152
|
+
summary: Tilt binding for Erbse.
|
130
153
|
test_files:
|
131
154
|
- test/dummy/Rakefile
|
132
155
|
- test/dummy/app/cells/song/with_content_tag.erb
|
156
|
+
- test/dummy/app/cells/song/with_content_tag_and_content_tag.erb
|
133
157
|
- test/dummy/app/cells/song/with_form_for_block.erb
|
158
|
+
- test/dummy/app/cells/song/with_form_tag_and_content_tag.erb
|
134
159
|
- test/dummy/app/cells/song_cell.rb
|
135
160
|
- test/dummy/app/controllers/application_controller.rb
|
136
161
|
- test/dummy/config.ru
|
@@ -142,4 +167,3 @@ test_files:
|
|
142
167
|
- test/dummy/config/routes.rb
|
143
168
|
- test/erb_test.rb
|
144
169
|
- test/test_helper.rb
|
145
|
-
has_rdoc:
|
data/gemfiles/rails_3.2.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "cells", :github => "apotonick/cells"
|
6
|
-
gem "appraisal"
|
7
|
-
gem "minitest-reporters"
|
8
|
-
gem "railties", :github => "rails/rails", :branch => "3-2-stable"
|
9
|
-
gem "tzinfo"
|
10
|
-
gem "minitest", "4.7.5"
|
11
|
-
|
12
|
-
platforms :mri_20, :mri_21 do
|
13
|
-
gem "pry-byebug"
|
14
|
-
end
|
15
|
-
|
16
|
-
gemspec :path => "../"
|
data/gemfiles/rails_4.0.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "cells", :github => "apotonick/cells"
|
6
|
-
gem "appraisal"
|
7
|
-
gem "minitest-reporters"
|
8
|
-
gem "railties", :github => "rails/rails", :branch => "4-0-stable"
|
9
|
-
gem "activemodel", :github => "rails/rails", :branch => "4-0-stable"
|
10
|
-
gem "minitest", "4.7.5"
|
11
|
-
|
12
|
-
platforms :mri_20, :mri_21 do
|
13
|
-
gem "pry-byebug"
|
14
|
-
end
|
15
|
-
|
16
|
-
gemspec :path => "../"
|
data/gemfiles/rails_4.1.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "cells", :github => "apotonick/cells"
|
6
|
-
gem "appraisal"
|
7
|
-
gem "minitest-reporters"
|
8
|
-
gem "railties", :github => "rails/rails", :branch => "4-1-stable"
|
9
|
-
gem "activemodel", :github => "rails/rails", :branch => "4-1-stable"
|
10
|
-
gem "minitest", "~> 5.2"
|
11
|
-
|
12
|
-
platforms :mri_20, :mri_21 do
|
13
|
-
gem "pry-byebug"
|
14
|
-
end
|
15
|
-
|
16
|
-
gemspec :path => "../"
|
data/gemfiles/rails_4.2.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "cells", :github => "apotonick/cells"
|
6
|
-
gem "appraisal"
|
7
|
-
gem "minitest-reporters"
|
8
|
-
gem "railties", :github => "rails/rails", :branch => "4-2-stable"
|
9
|
-
gem "activemodel", :github => "rails/rails", :branch => "4-2-stable"
|
10
|
-
gem "minitest", "~> 5.2"
|
11
|
-
|
12
|
-
platforms :mri_20, :mri_21 do
|
13
|
-
gem "pry-byebug"
|
14
|
-
end
|
15
|
-
|
16
|
-
gemspec :path => "../"
|
data/lib/cell/erb.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'cells'
|
2
|
-
require 'erubis/engine/eruby'
|
3
|
-
require 'tilt/erb'
|
4
|
-
|
5
|
-
# The original ERB implementation in Ruby doesn't support blocks like
|
6
|
-
# <%= form_for do %>
|
7
|
-
# which is fixed with this monkey-patch.
|
8
|
-
#
|
9
|
-
# TODO: don't monkey-patch, use this in cells/tilt, only!
|
10
|
-
module Erubis
|
11
|
-
module RubyGenerator
|
12
|
-
def init_generator(properties={})
|
13
|
-
super
|
14
|
-
@in_block = 0
|
15
|
-
@block_ignore = 0
|
16
|
-
end
|
17
|
-
|
18
|
-
def escaped_expr(code)
|
19
|
-
return "#{@escapefunc} #{code}"
|
20
|
-
end
|
21
|
-
|
22
|
-
def add_stmt(src, code)
|
23
|
-
if block_start? code
|
24
|
-
block_ignore
|
25
|
-
elsif block_end? code
|
26
|
-
src << @bufvar << ?;
|
27
|
-
block_end
|
28
|
-
end
|
29
|
-
|
30
|
-
src << "#{code};"
|
31
|
-
end
|
32
|
-
|
33
|
-
def add_expr_literal(src, code)
|
34
|
-
if block_start? code
|
35
|
-
src << "#@bufvar << #{code};"
|
36
|
-
block_start
|
37
|
-
src << "#@bufvar = '';"
|
38
|
-
else
|
39
|
-
src << "#{@bufvar} << (#{code}).to_s;"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def block_start? code
|
46
|
-
res = code =~ /\b(do|\{)(\s*\|[^|]*\|)?\s*\Z/
|
47
|
-
end
|
48
|
-
|
49
|
-
def block_start
|
50
|
-
@in_block += 1
|
51
|
-
@bufvar << '_tmp'
|
52
|
-
end
|
53
|
-
|
54
|
-
def block_ignore
|
55
|
-
@block_ignore += 1
|
56
|
-
end
|
57
|
-
|
58
|
-
def block_end? code
|
59
|
-
res = @in_block != 0 && code =~ /\bend\b|}/
|
60
|
-
if res && @block_ignore != 0
|
61
|
-
@block_ignore -= 1
|
62
|
-
return false
|
63
|
-
end
|
64
|
-
res
|
65
|
-
end
|
66
|
-
|
67
|
-
def block_end
|
68
|
-
@in_block -= 1
|
69
|
-
@bufvar.sub! /_tmp\Z/, ''
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
data/lib/cells/erb.rb
DELETED