erector 0.7.1 → 0.7.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.
- data/README.txt +14 -0
- data/VERSION.yml +1 -1
- data/bin/erector +9 -4
- data/lib/erector.rb +11 -17
- data/lib/erector/erected.rb +1 -1
- data/lib/erector/externals.rb +19 -16
- data/lib/erector/inline.rb +12 -11
- data/lib/erector/mixin.rb +5 -2
- data/lib/erector/rails.rb +26 -9
- data/lib/erector/rails/extensions/action_controller.rb +2 -14
- data/lib/erector/rails/extensions/rails_widget.rb +65 -25
- data/lib/erector/rails/extensions/rails_widget/rails_helpers.rb +4 -3
- data/lib/erector/rails/template_handlers/ert_handler.rb +1 -1
- data/lib/erector/rails/template_handlers/rb_handler.rb +8 -43
- data/lib/erector/widget.rb +147 -70
- data/lib/erector/widgets.rb +5 -4
- data/lib/erector/widgets/form.rb +30 -0
- data/lib/erector/widgets/page.rb +74 -49
- data/rails/init.rb +4 -0
- data/spec/erect/erect_rails_spec.rb +63 -26
- data/spec/erect/erected_spec.rb +4 -4
- data/spec/erector/external_spec.rb +64 -6
- data/spec/erector/indentation_spec.rb +2 -2
- data/spec/erector/inline_spec.rb +74 -42
- data/spec/erector/mixin_spec.rb +16 -5
- data/spec/erector/widget_spec.rb +184 -7
- data/spec/erector/widgets/form_spec.rb +31 -0
- data/spec/erector/widgets/page_spec.rb +30 -20
- data/spec/spec_suite.rb +4 -3
- metadata +5 -3
- data/lib/erector/rails/extensions/action_view.rb +0 -21
@@ -1,29 +1,39 @@
|
|
1
1
|
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
it "can suppress basic_styles" do
|
15
|
-
Page.new(:basic_styles => false).to_s.should_not =~ /.right {float: right;}/
|
3
|
+
describe Erector::Widgets::Page do
|
4
|
+
it "works" do
|
5
|
+
Erector::Widgets::Page.new.to_s
|
6
|
+
end
|
7
|
+
|
8
|
+
it "renders body_content" do
|
9
|
+
Class.new(Erector::Widgets::Page) do
|
10
|
+
def body_content
|
11
|
+
text "body_content"
|
16
12
|
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
end.new.to_s.should =~ /body_content/
|
14
|
+
end
|
15
|
+
|
16
|
+
it "renders a block passed to new" do
|
17
|
+
Erector::Widgets::Page.new do
|
18
|
+
text "body_content"
|
19
|
+
end.to_s.should =~ /body_content/
|
20
|
+
end
|
21
|
+
|
22
|
+
it "renders a block passed to content" do
|
23
|
+
Class.new(Erector::Widgets::Page) do
|
24
|
+
def content
|
25
|
+
super do
|
26
|
+
text "body_content"
|
21
27
|
end
|
22
28
|
end
|
29
|
+
end.new.to_s.should =~ /body_content/
|
30
|
+
end
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
it "allows subclasses to provide a css class for the body" do
|
33
|
+
Class.new(Erector::Widgets::Page) do
|
34
|
+
def body_attributes
|
35
|
+
{:class => "funky"}
|
26
36
|
end
|
27
|
-
end
|
37
|
+
end.new.to_s.should =~ /<body class=\"funky\">/
|
28
38
|
end
|
29
39
|
end
|
data/spec/spec_suite.rb
CHANGED
@@ -2,7 +2,7 @@ class SpecSuite
|
|
2
2
|
class << self
|
3
3
|
def all
|
4
4
|
system("ruby #{dir}/core_spec_suite.rb") || raise("Core Spec Suite failed")
|
5
|
-
|
5
|
+
|
6
6
|
require "#{dir}/../lib/erector/rails/rails_version"
|
7
7
|
|
8
8
|
rails_version = Erector::Rails::RAILS_VERSION
|
@@ -12,10 +12,11 @@ class SpecSuite
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def core
|
15
|
-
run Dir["#{dir}/{erect,erector}/**/*_spec.rb"]
|
15
|
+
run Dir["#{dir}/{erect,erector}/**/*_spec.rb"] - ["#{dir}/erect/erect_rails_spec.rb"]
|
16
16
|
end
|
17
17
|
|
18
18
|
def rails
|
19
|
+
run ["#{dir}/erect/erect_rails_spec.rb"]
|
19
20
|
Dir.chdir("#{dir}/rails_root") do
|
20
21
|
run Dir["spec/**/*_spec.rb"]
|
21
22
|
end
|
@@ -36,4 +37,4 @@ end
|
|
36
37
|
|
37
38
|
if $0 == __FILE__
|
38
39
|
SpecSuite.all
|
39
|
-
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pivotal Labs
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-16 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,7 +39,6 @@ files:
|
|
39
39
|
- lib/erector/inline.rb
|
40
40
|
- lib/erector/mixin.rb
|
41
41
|
- lib/erector/rails/extensions/action_controller.rb
|
42
|
-
- lib/erector/rails/extensions/action_view.rb
|
43
42
|
- lib/erector/rails/extensions/rails_widget/rails_helpers.rb
|
44
43
|
- lib/erector/rails/extensions/rails_widget.rb
|
45
44
|
- lib/erector/rails/rails_form_builder.rb
|
@@ -55,10 +54,12 @@ files:
|
|
55
54
|
- lib/erector/widget.rb
|
56
55
|
- lib/erector/widgets/environment_badge.rb
|
57
56
|
- lib/erector/widgets/field_table.rb
|
57
|
+
- lib/erector/widgets/form.rb
|
58
58
|
- lib/erector/widgets/page.rb
|
59
59
|
- lib/erector/widgets/table.rb
|
60
60
|
- lib/erector/widgets.rb
|
61
61
|
- lib/erector.rb
|
62
|
+
- rails/init.rb
|
62
63
|
- README.txt
|
63
64
|
- VERSION.yml
|
64
65
|
- bin/erector
|
@@ -74,6 +75,7 @@ files:
|
|
74
75
|
- spec/erector/unicode_builder_spec.rb
|
75
76
|
- spec/erector/widget_spec.rb
|
76
77
|
- spec/erector/widgets/field_table_spec.rb
|
78
|
+
- spec/erector/widgets/form_spec.rb
|
77
79
|
- spec/erector/widgets/page_spec.rb
|
78
80
|
- spec/erector/widgets/table_spec.rb
|
79
81
|
- spec/rails_spec_suite.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
unless ActionView.const_defined?(:Template)
|
2
|
-
ActionView::Base.class_eval do
|
3
|
-
attr_reader :template_file_path
|
4
|
-
def render_template_with_saving_file_path(template_extension, template, file_path = nil, local_assigns = {})
|
5
|
-
@template_file_path = file_path
|
6
|
-
render_template_without_saving_file_path(template_extension, template, file_path, local_assigns)
|
7
|
-
end
|
8
|
-
alias_method_chain :render_template, :saving_file_path
|
9
|
-
|
10
|
-
def render_partial_with_notification(*args, &blk)
|
11
|
-
@is_partial_template = true
|
12
|
-
render_partial_without_notification(*args, &blk)
|
13
|
-
end
|
14
|
-
alias_method_chain :render_partial, :notification
|
15
|
-
|
16
|
-
def is_partial_template?
|
17
|
-
@is_partial_template || false
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|