pakada-render 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,13 +54,16 @@ class Pakada::Render
54
54
 
55
55
  content = []
56
56
  response[2].each {|chunk| content << chunk }
57
- response[2] = [render!(:layout, :content => content)]
57
+ response[2] = [render!(:layout, :content => content,
58
+ :@response => response)]
58
59
  end
59
60
  end
60
61
 
61
62
  def boot
63
+ rendering = Pakada.safety(Pakada::Render::Rendering)
64
+ Pakada.safety(Pakada::Render::RenderingContext).send :include, rendering
62
65
  Pakada.modules.each_value {|mod|
63
- mod.extend Pakada.safety(Pakada::Render::Rendering)
66
+ mod.extend rendering
64
67
  }
65
68
 
66
69
  @load_path = build_load_path
@@ -1,5 +1,5 @@
1
1
  class Pakada
2
2
  class Render
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -38,9 +38,12 @@ describe Pakada::Render do
38
38
  render.boot
39
39
  }
40
40
 
41
- it "includes Rendering into each module" do
41
+ it "includes Rendering into RenderingContext and each module" do
42
+ rendering_context = Pakada.safety(Pakada::Render::RenderingContext)
43
+ rendering = Pakada.safety(Pakada::Render::Rendering)
44
+
45
+ rendering_context.included_modules.should include(rendering)
42
46
  Pakada.modules.each_value {|mod|
43
- rendering = Pakada.safety(Pakada::Render::Rendering)
44
47
  (class << mod; self; end).included_modules.should include(rendering)
45
48
  }
46
49
  end
@@ -243,6 +246,14 @@ describe Pakada::Render do
243
246
  render.render_layout response
244
247
  end
245
248
 
249
+ it "passes the response as @response" do
250
+ render.should_receive(:render) {|template, locals|
251
+ locals[:@response].should equal(response)
252
+ renderer
253
+ }
254
+ render.render_layout response
255
+ end
256
+
246
257
  it "deletes the Content-Length header" do
247
258
  render.render_layout response
248
259
  response[1].key?("Content-Length").should be_false
@@ -1,3 +1,20 @@
1
- <pre>
2
- <%= content.join "\n" %>
3
- </pre>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <title>Pakada</title>
7
+ <meta name="description" content="Pakada's boilerplate theme">
8
+ <meta name="author" content="Lars Gierth">
9
+ <%= stylesheet_assets.join "\n" if respond_to? :stylesheet_assets %>
10
+ </head>
11
+ <body>
12
+ <header>Pakada's boilerplate theme</header>
13
+ <div role="main">
14
+ <%= content.join "\n" %>
15
+ </div>
16
+ <footer><a href="https://github.com/lgierth">github.com/lgierth</a></footer>
17
+
18
+ <%= script_assets.join "\n" if respond_to? :script_assets %>
19
+ </body>
20
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakada-render
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
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: 2011-09-18 00:00:00.000000000Z
12
+ date: 2011-10-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pakada
16
- requirement: &71560660 !ruby/object:Gem::Requirement
16
+ requirement: &70980180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *71560660
24
+ version_requirements: *70980180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tilt
27
- requirement: &71560130 !ruby/object:Gem::Requirement
27
+ requirement: &70979740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *71560130
35
+ version_requirements: *70979740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hike
38
- requirement: &71559780 !ruby/object:Gem::Requirement
38
+ requirement: &70979320 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *71559780
46
+ version_requirements: *70979320
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &71559410 !ruby/object:Gem::Requirement
49
+ requirement: &70979050 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *71559410
57
+ version_requirements: *70979050
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: fakefs
60
- requirement: &71559120 !ruby/object:Gem::Requirement
60
+ requirement: &70978760 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *71559120
68
+ version_requirements: *70978760
69
69
  description:
70
70
  email:
71
71
  - lars.gierth@gmail.com
@@ -78,8 +78,6 @@ files:
78
78
  - LICENSE
79
79
  - README.md
80
80
  - Rakefile
81
- - config.ru
82
- - controllers/foo.rb
83
81
  - lib/pakada-render.rb
84
82
  - lib/pakada/render.rb
85
83
  - lib/pakada/render/controller.rb
@@ -94,7 +92,6 @@ files:
94
92
  - spec/rendering_spec.rb
95
93
  - spec/spec_helper.rb
96
94
  - templates/layout.erb
97
- - templates/my_module/foo/bar.erb
98
95
  homepage: https://rubygems.org/gems/pakada-render
99
96
  licenses: []
100
97
  post_install_message:
@@ -120,3 +117,4 @@ signing_key:
120
117
  specification_version: 3
121
118
  summary: Template rendering for Pakada
122
119
  test_files: []
120
+ has_rdoc:
data/config.ru DELETED
@@ -1,16 +0,0 @@
1
- require "pakada/dispatch"
2
- require "pakada/render"
3
- require "awesome_print"
4
-
5
- class ::MyModule
6
- include Pakada::Module
7
- @path = Pathname.new(".")
8
- @dependencies << Pakada::Dispatch << Pakada::Render
9
-
10
- def routes
11
- route :test, "/", &controller(:foo).action(:bar)
12
- end
13
- end
14
-
15
- Pakada.boot
16
- run Pakada
@@ -1,3 +0,0 @@
1
- action(:bar) {
2
- @name = "world"
3
- }
@@ -1 +0,0 @@
1
- hello <%= @name %>!