erector-rails4 0.0.1 → 0.0.2
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/.gitignore +2 -1
- data/.travis.yml +3 -0
- data/Gemfile.lock +4 -0
- data/LICENSE.md +20 -0
- data/README.md +7 -1
- data/erector-rails4.gemspec +1 -0
- data/lib/erector/rails.rb +6 -2
- data/lib/erector/version.rb +1 -1
- data/spec/dummy/app/controllers/application_controller.rb +1 -0
- data/spec/dummy/app/helpers/application_helper.rb +5 -0
- data/spec/dummy/app/views/test/simple_form.html.rb +6 -0
- data/spec/dummy/spec/rails_helpers_spec.rb +23 -1
- metadata +18 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 698a798895f015322b464b08fa3fa1ee83921818
|
4
|
+
data.tar.gz: ab61ab0f8af649554dd0c3b70fbdabe565ef159f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9848215dcb48b74b4a39de690d00ddcd5da95f2426c53252fd81390d0032cb460c01df0ec586a8bd5279e3cabdbd77ef35aa63735b36d3dafd091e2f16c3573a
|
7
|
+
data.tar.gz: ba35747f63989b18c9d248000a20b1e8195923089ac9fe15d4c7b4b71ec40448d1059441b6161c70c9e102bbb8050b92634f4f39b7891da4514f39f529cd7578
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -96,6 +96,9 @@ GEM
|
|
96
96
|
sexp_processor (~> 4.1)
|
97
97
|
sass (3.2.12)
|
98
98
|
sexp_processor (4.4.0)
|
99
|
+
simple_form (3.0.1)
|
100
|
+
actionpack (>= 4.0.0, < 4.1)
|
101
|
+
activemodel (>= 4.0.0, < 4.1)
|
99
102
|
simplecov (0.7.1)
|
100
103
|
multi_json (~> 1.0)
|
101
104
|
simplecov-html (~> 0.7.1)
|
@@ -139,5 +142,6 @@ DEPENDENCIES
|
|
139
142
|
rr
|
140
143
|
rspec-rails (= 2.12.2)
|
141
144
|
sass
|
145
|
+
simple_form
|
142
146
|
sqlite3
|
143
147
|
wrong (>= 0.5.4)
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Adam Becker
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
Erector for Rails 4
|
1
|
+
Erector for Rails 4
|
2
2
|
=====
|
3
3
|
|
4
|
+
[](http://badge.fury.io/rb/erector-rails4) [](https://travis-ci.org/adamjacobbecker/erector-rails4) [](https://coveralls.io/r/adamjacobbecker/erector-rails4) [](https://codeclimate.com/github/adamjacobbecker/erector-rails4)
|
5
|
+
|
4
6
|
This is a fork of [Erector](https://github.com/erector/erector) with a lotta old crap removed. Currently under active development, but in regular use at [DOBT](https://www.github.com/dobtco).
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'erector-rails4', require: 'erector'
|
10
|
+
```
|
data/erector-rails4.gemspec
CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_development_dependency 'rr'
|
31
31
|
s.add_development_dependency 'rspec-rails', '2.12.2'
|
32
32
|
s.add_development_dependency 'sass'
|
33
|
+
s.add_development_dependency 'simple_form'
|
33
34
|
s.add_development_dependency 'sqlite3'
|
34
35
|
s.add_development_dependency 'wrong', ">=0.5.4"
|
35
36
|
|
data/lib/erector/rails.rb
CHANGED
@@ -53,11 +53,11 @@ module Erector
|
|
53
53
|
METHOD_DEF
|
54
54
|
end
|
55
55
|
|
56
|
-
def def_rails_form_helper(method_name)
|
56
|
+
def def_rails_form_helper(method_name, explicit_builder = nil)
|
57
57
|
module_eval <<-METHOD_DEF, __FILE__, __LINE__+1
|
58
58
|
def #{method_name}(*args, &block)
|
59
59
|
options = args.extract_options!
|
60
|
-
args << options.merge(:builder => FormBuilder.wrapping(options[:builder]))
|
60
|
+
args << options.merge(:builder => FormBuilder.wrapping(#{explicit_builder || 'options[:builder]'}))
|
61
61
|
text helpers.#{method_name}(*args, &block)
|
62
62
|
end
|
63
63
|
METHOD_DEF
|
@@ -216,6 +216,10 @@ module Erector
|
|
216
216
|
def_rails_form_helper(method_name)
|
217
217
|
end
|
218
218
|
|
219
|
+
[:simple_form_for, :simple_fields_for].each do |method_name|
|
220
|
+
def_rails_form_helper(method_name, "SimpleForm::FormBuilder")
|
221
|
+
end
|
222
|
+
|
219
223
|
Erector::Widget.send :include, self
|
220
224
|
end
|
221
225
|
end
|
data/lib/erector/version.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require File.expand_path("#{File.dirname(__FILE__)}/rails_spec_helper")
|
2
|
+
require 'simple_form'
|
2
3
|
|
3
4
|
describe Erector::Rails do
|
4
5
|
before do
|
5
|
-
@controller =
|
6
|
+
@controller = ApplicationController.new
|
6
7
|
@controller.request = ActionController::TestRequest.new
|
7
8
|
|
8
9
|
@view = ActionView::Base.new
|
@@ -17,6 +18,16 @@ describe Erector::Rails do
|
|
17
18
|
Erector::Rails.render(Erector.inline(&block), @controller.view_context)
|
18
19
|
end
|
19
20
|
|
21
|
+
describe "a non-output helper" do
|
22
|
+
it "does not render to the output buffer" do
|
23
|
+
test_render do
|
24
|
+
if user_role == 'admin'
|
25
|
+
text 'foo'
|
26
|
+
end
|
27
|
+
end.should == %{foo}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
20
31
|
describe "#link_to" do
|
21
32
|
it "renders a link" do
|
22
33
|
test_render do
|
@@ -233,4 +244,15 @@ describe Erector::Rails do
|
|
233
244
|
end.should =~ /foo/
|
234
245
|
end
|
235
246
|
end
|
247
|
+
|
248
|
+
describe "#simple_form_for" do
|
249
|
+
it "instantiates a SimpleForm builder" do
|
250
|
+
test_render do
|
251
|
+
simple_form_for(:something, :url => "/test") do |form|
|
252
|
+
form.input :foobar
|
253
|
+
end
|
254
|
+
end.should =~ /foobar/
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
236
258
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erector-rails4
|
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
|
- Alex Chaffee
|
@@ -127,6 +127,20 @@ dependencies:
|
|
127
127
|
- - '>='
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
|
+
- !ruby/object:Gem::Dependency
|
131
|
+
name: simple_form
|
132
|
+
requirement: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
type: :development
|
138
|
+
prerelease: false
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
130
144
|
- !ruby/object:Gem::Dependency
|
131
145
|
name: sqlite3
|
132
146
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,6 +183,7 @@ files:
|
|
169
183
|
- .travis.yml
|
170
184
|
- Gemfile
|
171
185
|
- Gemfile.lock
|
186
|
+
- LICENSE.md
|
172
187
|
- README.md
|
173
188
|
- Rakefile
|
174
189
|
- erector-rails4.gemspec
|
@@ -230,6 +245,7 @@ files:
|
|
230
245
|
- spec/dummy/app/views/test/render_partial.html.rb
|
231
246
|
- spec/dummy/app/views/test/render_with_widget_as_layout.rb
|
232
247
|
- spec/dummy/app/views/test/render_with_widget_as_layout_using_content_for.rb
|
248
|
+
- spec/dummy/app/views/test/simple_form.html.rb
|
233
249
|
- spec/dummy/config.ru
|
234
250
|
- spec/dummy/config/application.rb
|
235
251
|
- spec/dummy/config/boot.rb
|
@@ -322,6 +338,7 @@ test_files:
|
|
322
338
|
- spec/dummy/app/views/test/render_partial.html.rb
|
323
339
|
- spec/dummy/app/views/test/render_with_widget_as_layout.rb
|
324
340
|
- spec/dummy/app/views/test/render_with_widget_as_layout_using_content_for.rb
|
341
|
+
- spec/dummy/app/views/test/simple_form.html.rb
|
325
342
|
- spec/dummy/config.ru
|
326
343
|
- spec/dummy/config/application.rb
|
327
344
|
- spec/dummy/config/boot.rb
|