scharfie-bones 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/bones.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "bones"
3
- s.version = "0.2.0"
4
- s.date = "2009-02-05"
3
+ s.version = "0.2.1"
4
+ s.date = "2009-02-10"
5
5
  s.authors = ["Chris Scharf", "Ryan Heath"]
6
6
  s.email = "scharfie@gmail.com"
7
7
 
@@ -70,4 +70,4 @@ Gem::Specification.new do |s|
70
70
  # Dependencies
71
71
  s.add_dependency("rack", ["= 0.3.0"])
72
72
  s.add_dependency("activesupport", [">= 2.1.0"])
73
- end
73
+ end
@@ -37,25 +37,33 @@ class Bones
37
37
 
38
38
  ensure_file(Bones.root / 'layouts' / 'application.html.erb') do |f|
39
39
  f.write <<-HTML
40
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
41
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
42
- <html>
43
- <head>
44
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
45
- <title>Welcome to bones</title>
46
- <%= stylesheet_link_tag 'styles' %>
47
- <%= javascript_include_tag %>
48
- </head>
49
- <body>
50
- <h1>Welcome to <strong>bones</strong></h1>
51
- <%= @content_for_layout %>
52
- </body>
53
- </html>
40
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
41
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
42
+ <html>
43
+ <head>
44
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
45
+ <title>Welcome to bones</title>
46
+ <%= stylesheet_link_tag 'styles' %>
47
+ <%= javascript_include_tag %>
48
+ </head>
49
+ <body>
50
+ <h1>Welcome to <strong>bones</strong></h1>
51
+ <%= yield %>
52
+ </body>
53
+ </html>
54
54
  HTML
55
55
  end
56
56
 
57
57
  ensure_file(Bones.root / 'public' / 'stylesheets' / 'styles.css')
58
58
 
59
+ ensure_file(Bones.root / 'helpers' / 'application_helper.rb') do |f|
60
+ f.write <<-HELPER
61
+ # Provide any custom helpers that want in this module
62
+ module ApplicationHelper
63
+ end
64
+ HELPER
65
+ end
66
+
59
67
  ensure_file(Bones.root / 'Rakefile') do |f|
60
68
  puts "** Adding Rakefile to parent directory"
61
69
  f.write File.read(Bones.system_path / 'Rakefile')
@@ -82,7 +82,10 @@ class Bones
82
82
 
83
83
  if layout && File.file?(layout_filename)
84
84
  erb = ERB.new(File.read(layout_filename))
85
- erb.result(binding)
85
+ eval(erb.src) do |key|
86
+ key = :layout if key.blank?
87
+ instance_variable_get(:"@content_for_#{key}")
88
+ end
86
89
  else
87
90
  @content_for_layout
88
91
  end
@@ -141,5 +141,5 @@ module CoreHelper
141
141
  # Returns base URL
142
142
  def base
143
143
  Bones.base
144
- end
144
+ end
145
145
  end
@@ -1,2 +1,3 @@
1
1
  Example Layout
2
- <%= @content_for_layout %>
2
+ <%= yield %>
3
+ <%= yield :name %>
@@ -1,2 +1,4 @@
1
+ About page
2
+ <% content_for(:name, 'Chris') %>
1
3
  <% layout 'example_layout' %>
2
4
  <%= some_custom_helper %>
@@ -65,5 +65,9 @@ context "Bones template 'about'" do
65
65
  test "should use layout 'example_layout'" do
66
66
  assert_equal 'example_layout', @template.layout
67
67
  assert_include @response, 'Example Layout'
68
+ assert_include @response, 'About page'
69
+ assert_include @response, 'Chris'
70
+
71
+ assert 'Chris', @template.instance_variable_get(:@content_for_name)
68
72
  end
69
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scharfie-bones
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Scharf
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-02-05 00:00:00 -08:00
13
+ date: 2009-02-10 00:00:00 -08:00
14
14
  default_executable: bones
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency