renee-render 0.3.7 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
data/lib/renee_render.rb CHANGED
@@ -31,6 +31,17 @@ module Renee
31
31
  def default_encoding(encoding = nil)
32
32
  encoding ? @encoding = encoding : @encoding
33
33
  end
34
+
35
+ # Gets or sets the default layout used.
36
+ #
37
+ # @param [String] layout The layout to use. e.g. "application.haml"
38
+ def default_layout(*args)
39
+ case args.size
40
+ when 0 then @layout
41
+ when 1 then @layout = args.first
42
+ else raise
43
+ end
44
+ end
34
45
  end
35
46
 
36
47
  ##
@@ -154,7 +165,7 @@ module Renee
154
165
 
155
166
  locals = options.delete(:locals) || {}
156
167
  views = options.delete(:views) || self.class.views_path || "./views"
157
- layout = options.delete(:layout)
168
+ layout = options.key?(:layout) ? options[:layout] : self.class.default_layout
158
169
  layout_engine = options.delete(:layout_engine)
159
170
  # TODO suppress template errors for layouts?
160
171
  # TODO allow content_type to be set with an option to render?
data/renee-render.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.summary = %q{The super-friendly web framework rendering component}
12
12
  s.description = %q{The super-friendly web framework rendering component.}
13
13
 
14
- s.rubyforge_project = "renee"
14
+ s.rubyforge_project = "renee-render"
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/test/render_test.rb CHANGED
@@ -71,6 +71,29 @@ describe Renee::Render do
71
71
  assert_equal %Q{<div class='wrapper'><p>bar</p></div>\n}, response.body
72
72
  end # with engine and layout specified
73
73
 
74
+ it "should allow rendering template file with engine and layout" do
75
+ create_view :index, "%p test", :haml
76
+ create_view :foo, "%p= foo", :haml
77
+ create_view :layout, "%div.wrapper= yield", :haml
78
+ create_view :layout2, "%div.wrapper2= yield", :haml
79
+ mock_app {
80
+ path("/a") { get { render! 'index', :haml } }
81
+ path("/b") { get { render! 'foo', :layout => :layout2, :locals => { :foo => "bar" } } }
82
+ path("/c") { get { render! 'foo', :layout => nil, :locals => { :foo => "bar" } } }
83
+ }.setup {
84
+ default_layout :layout
85
+ }
86
+ get('/a')
87
+ assert_equal 200, response.status
88
+ assert_equal %Q{<div class='wrapper'><p>test</p></div>\n}, response.body
89
+ get('/b')
90
+ assert_equal 200, response.status
91
+ assert_equal %Q{<div class='wrapper2'><p>bar</p></div>\n}, response.body
92
+ get('/c')
93
+ assert_equal 200, response.status
94
+ assert_equal %Q{<p>bar</p>\n}, response.body
95
+ end # with engine and layout specified
96
+
74
97
  it "should allow rendering template with different layout engines" do
75
98
  create_view :index, "%p test", :haml
76
99
  create_view :foo, "%p= foo", :haml
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renee-render
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 7
4
5
  prerelease:
5
- version: 0.3.7
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 10
10
+ version: 0.3.10
6
11
  platform: ruby
7
12
  authors:
8
13
  - Josh Hull
@@ -12,108 +17,148 @@ autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
19
 
15
- date: 2011-12-06 00:00:00 -08:00
16
- default_executable:
20
+ date: 2011-12-20 00:00:00 Z
17
21
  dependencies:
18
22
  - !ruby/object:Gem::Dependency
19
- name: rack
20
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
21
24
  none: false
22
25
  requirements:
23
26
  - - ~>
24
27
  - !ruby/object:Gem::Version
28
+ hash: 27
29
+ segments:
30
+ - 1
31
+ - 3
32
+ - 0
25
33
  version: 1.3.0
34
+ requirement: *id001
26
35
  type: :runtime
27
36
  prerelease: false
28
- version_requirements: *id001
37
+ name: rack
29
38
  - !ruby/object:Gem::Dependency
30
- name: tilt
31
- requirement: &id002 !ruby/object:Gem::Requirement
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
32
40
  none: false
33
41
  requirements:
34
42
  - - ~>
35
43
  - !ruby/object:Gem::Version
44
+ hash: 29
45
+ segments:
46
+ - 1
47
+ - 3
48
+ - 3
36
49
  version: 1.3.3
50
+ requirement: *id002
37
51
  type: :runtime
38
52
  prerelease: false
39
- version_requirements: *id002
53
+ name: tilt
40
54
  - !ruby/object:Gem::Dependency
41
- name: callsite
42
- requirement: &id003 !ruby/object:Gem::Requirement
55
+ version_requirements: &id003 !ruby/object:Gem::Requirement
43
56
  none: false
44
57
  requirements:
45
58
  - - ~>
46
59
  - !ruby/object:Gem::Version
60
+ hash: 19
61
+ segments:
62
+ - 0
63
+ - 0
64
+ - 6
47
65
  version: 0.0.6
66
+ requirement: *id003
48
67
  type: :runtime
49
68
  prerelease: false
50
- version_requirements: *id003
69
+ name: callsite
51
70
  - !ruby/object:Gem::Dependency
52
- name: renee-core
53
- requirement: &id004 !ruby/object:Gem::Requirement
71
+ version_requirements: &id004 !ruby/object:Gem::Requirement
54
72
  none: false
55
73
  requirements:
56
74
  - - "="
57
75
  - !ruby/object:Gem::Version
58
- version: 0.3.7
76
+ hash: 7
77
+ segments:
78
+ - 0
79
+ - 3
80
+ - 10
81
+ version: 0.3.10
82
+ requirement: *id004
59
83
  type: :runtime
60
84
  prerelease: false
61
- version_requirements: *id004
85
+ name: renee-core
62
86
  - !ruby/object:Gem::Dependency
63
- name: minitest
64
- requirement: &id005 !ruby/object:Gem::Requirement
87
+ version_requirements: &id005 !ruby/object:Gem::Requirement
65
88
  none: false
66
89
  requirements:
67
90
  - - ~>
68
91
  - !ruby/object:Gem::Version
92
+ hash: 21
93
+ segments:
94
+ - 2
95
+ - 6
96
+ - 1
69
97
  version: 2.6.1
98
+ requirement: *id005
70
99
  type: :development
71
100
  prerelease: false
72
- version_requirements: *id005
101
+ name: minitest
73
102
  - !ruby/object:Gem::Dependency
74
- name: rake
75
- requirement: &id006 !ruby/object:Gem::Requirement
103
+ version_requirements: &id006 !ruby/object:Gem::Requirement
76
104
  none: false
77
105
  requirements:
78
106
  - - ">="
79
107
  - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
80
111
  version: "0"
112
+ requirement: *id006
81
113
  type: :development
82
114
  prerelease: false
83
- version_requirements: *id006
115
+ name: rake
84
116
  - !ruby/object:Gem::Dependency
85
- name: bundler
86
- requirement: &id007 !ruby/object:Gem::Requirement
117
+ version_requirements: &id007 !ruby/object:Gem::Requirement
87
118
  none: false
88
119
  requirements:
89
120
  - - ">="
90
121
  - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
124
+ - 0
91
125
  version: "0"
126
+ requirement: *id007
92
127
  type: :development
93
128
  prerelease: false
94
- version_requirements: *id007
129
+ name: bundler
95
130
  - !ruby/object:Gem::Dependency
96
- name: rack-test
97
- requirement: &id008 !ruby/object:Gem::Requirement
131
+ version_requirements: &id008 !ruby/object:Gem::Requirement
98
132
  none: false
99
133
  requirements:
100
134
  - - ">="
101
135
  - !ruby/object:Gem::Version
136
+ hash: 11
137
+ segments:
138
+ - 0
139
+ - 5
140
+ - 0
102
141
  version: 0.5.0
142
+ requirement: *id008
103
143
  type: :development
104
144
  prerelease: false
105
- version_requirements: *id008
145
+ name: rack-test
106
146
  - !ruby/object:Gem::Dependency
107
- name: haml
108
- requirement: &id009 !ruby/object:Gem::Requirement
147
+ version_requirements: &id009 !ruby/object:Gem::Requirement
109
148
  none: false
110
149
  requirements:
111
150
  - - ">="
112
151
  - !ruby/object:Gem::Version
152
+ hash: 7
153
+ segments:
154
+ - 2
155
+ - 2
156
+ - 0
113
157
  version: 2.2.0
158
+ requirement: *id009
114
159
  type: :development
115
160
  prerelease: false
116
- version_requirements: *id009
161
+ name: haml
117
162
  description: The super-friendly web framework rendering component.
118
163
  email:
119
164
  - joshbuddy@gmail.com
@@ -134,7 +179,6 @@ files:
134
179
  - renee-render.gemspec
135
180
  - test/render_test.rb
136
181
  - test/test_helper.rb
137
- has_rdoc: true
138
182
  homepage: http://reneerb.com
139
183
  licenses: []
140
184
 
@@ -148,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
192
  requirements:
149
193
  - - ">="
150
194
  - !ruby/object:Gem::Version
151
- hash: 3690837816522299501
195
+ hash: 3
152
196
  segments:
153
197
  - 0
154
198
  version: "0"
@@ -157,17 +201,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
201
  requirements:
158
202
  - - ">="
159
203
  - !ruby/object:Gem::Version
160
- hash: 3690837816522299501
204
+ hash: 3
161
205
  segments:
162
206
  - 0
163
207
  version: "0"
164
208
  requirements: []
165
209
 
166
- rubyforge_project: renee
167
- rubygems_version: 1.6.2
210
+ rubyforge_project: renee-render
211
+ rubygems_version: 1.8.10
168
212
  signing_key:
169
213
  specification_version: 3
170
214
  summary: The super-friendly web framework rendering component
171
215
  test_files:
172
216
  - test/render_test.rb
173
217
  - test/test_helper.rb
218
+ has_rdoc: