fir 0.0.11 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ module PriceHelper
2
+ def number_to_price(num)
3
+ dollars = num.to_i
4
+ cents = (num - dollars) * 100
5
+ "$#{dollars}.#{cents}"
6
+ end
7
+ end
@@ -2,6 +2,8 @@
2
2
 
3
3
  <p><%= link_to 'Back to products', '/products' %></p>
4
4
 
5
+ <p><%= number_to_price(2.50) %></p>
6
+
5
7
  <p>Catch those varmints!</p>
6
8
 
7
9
  <p>Released: May 12th 1964 (<%= Date.today.year - 1964 %> years ago)</p>
@@ -43,6 +43,8 @@
43
43
 
44
44
  <p><a href="/products">Back to products</a></p>
45
45
 
46
+ <p>$2.50.0</p>
47
+
46
48
  <p>Catch those varmints!</p>
47
49
 
48
50
  <p>Released: May 12th 1964 (46 years ago)</p>
data/lib/fir.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'rack'
2
3
  require 'ostruct'
3
4
  require 'yaml'
@@ -7,6 +7,7 @@ module Fir
7
7
  # directory fixes that.
8
8
  Dir.chdir(FIR_ROOT)
9
9
  ::Fir.validate_config
10
+ ::Fir.load_support_files
10
11
  #use ::Rack::Reloader # Only when developing the Fir gem
11
12
  use ::Rack::ContentLength
12
13
  use ::Fir::Static
@@ -27,6 +27,19 @@ module Fir
27
27
  crypted_password
28
28
  end
29
29
 
30
+ def self.load_support_files
31
+ Dir.glob(File.join(FIR_ROOT, 'helpers', '*.rb')).each do |helper_file|
32
+ require File.expand_path(helper_file)
33
+ mod_name = File.basename(helper_file, File.extname(helper_file)).classify
34
+ begin
35
+ mod = Object.const_get(mod_name)
36
+ rescue NameError
37
+ raise "Expected helpers/#{helper_file} to define #{mod_name}"
38
+ end
39
+ ErbAdapter.send(:include, mod)
40
+ end
41
+ end
42
+
30
43
  def self.sanitize_page(page)
31
44
  page.gsub('../', '')
32
45
  end
@@ -43,6 +43,11 @@ describe 'Fir' do
43
43
  last_response.should contain('Sorry, there is nothing at this address.')
44
44
  end
45
45
 
46
+ it 'uses site-specific helpers' do
47
+ get '/products/mouse-trap'
48
+ last_response.should contain('$2.50')
49
+ end
50
+
46
51
  context 'with caching on' do
47
52
  before :each do
48
53
  Fir.config.perform_caching = true
@@ -7,6 +7,7 @@ require 'spec/autorun'
7
7
  require 'rack/test'
8
8
  require 'webrat'
9
9
  require 'rake'
10
+ require 'net/http'
10
11
 
11
12
  Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
12
13
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fir
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 0
8
- - 11
9
- version: 0.0.11
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - jarrett
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-03-22 00:00:00 -05:00
18
+ date: 2010-05-22 00:00:00 -05:00
18
19
  default_executable: fir
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 13
27
30
  segments:
28
31
  - 1
29
32
  - 2
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: webrat
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 3
41
46
  segments:
42
47
  - 0
43
48
  - 7
@@ -49,9 +54,11 @@ dependencies:
49
54
  name: rack-test
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 13
55
62
  segments:
56
63
  - 0
57
64
  - 5
@@ -63,9 +70,11 @@ dependencies:
63
70
  name: testunitxml
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ">="
68
76
  - !ruby/object:Gem::Version
77
+ hash: 17
69
78
  segments:
70
79
  - 0
71
80
  - 1
@@ -77,9 +86,11 @@ dependencies:
77
86
  name: activesupport
78
87
  prerelease: false
79
88
  requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
80
90
  requirements:
81
91
  - - ">="
82
92
  - !ruby/object:Gem::Version
93
+ hash: 9
83
94
  segments:
84
95
  - 2
85
96
  - 3
@@ -91,9 +102,11 @@ dependencies:
91
102
  name: rack
92
103
  prerelease: false
93
104
  requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
94
106
  requirements:
95
107
  - - ">="
96
108
  - !ruby/object:Gem::Version
109
+ hash: 21
97
110
  segments:
98
111
  - 1
99
112
  - 0
@@ -105,9 +118,11 @@ dependencies:
105
118
  name: builder
106
119
  prerelease: false
107
120
  requirement: &id007 !ruby/object:Gem::Requirement
121
+ none: false
108
122
  requirements:
109
123
  - - ">="
110
124
  - !ruby/object:Gem::Version
125
+ hash: 15
111
126
  segments:
112
127
  - 2
113
128
  - 1
@@ -119,9 +134,11 @@ dependencies:
119
134
  name: maruku
120
135
  prerelease: false
121
136
  requirement: &id008 !ruby/object:Gem::Requirement
137
+ none: false
122
138
  requirements:
123
139
  - - ">="
124
140
  - !ruby/object:Gem::Version
141
+ hash: 7
125
142
  segments:
126
143
  - 0
127
144
  - 6
@@ -145,6 +162,7 @@ files:
145
162
  - example/config.rb
146
163
  - example/config.ru
147
164
  - example/deploy.yml
165
+ - example/helpers/price_helper.rb
148
166
  - example/layouts/application.html.erb
149
167
  - example/menus.yml
150
168
  - example/pages.yml
@@ -192,6 +210,17 @@ files:
192
210
  - skeleton/tmp/restart.txt
193
211
  - LICENSE
194
212
  - README.markdown
213
+ - spec/admin_spec.rb
214
+ - spec/fir_spec.rb
215
+ - spec/generator_spec.rb
216
+ - spec/rack_integration_spec.rb
217
+ - spec/spec_helper.rb
218
+ - spec/support/cache_testing.rb
219
+ - spec/support/file_matchers.rb
220
+ - spec/support/server_matchers.rb
221
+ - spec/support/server_testing.rb
222
+ - spec/support/test_app_setup.rb
223
+ - spec/tasks_spec.rb
195
224
  has_rdoc: true
196
225
  homepage: http://github.com/jarrett/fir
197
226
  licenses: []
@@ -202,23 +231,27 @@ rdoc_options:
202
231
  require_paths:
203
232
  - lib
204
233
  required_ruby_version: !ruby/object:Gem::Requirement
234
+ none: false
205
235
  requirements:
206
236
  - - ">="
207
237
  - !ruby/object:Gem::Version
238
+ hash: 3
208
239
  segments:
209
240
  - 0
210
241
  version: "0"
211
242
  required_rubygems_version: !ruby/object:Gem::Requirement
243
+ none: false
212
244
  requirements:
213
245
  - - ">="
214
246
  - !ruby/object:Gem::Version
247
+ hash: 3
215
248
  segments:
216
249
  - 0
217
250
  version: "0"
218
251
  requirements: []
219
252
 
220
253
  rubyforge_project:
221
- rubygems_version: 1.3.6
254
+ rubygems_version: 1.3.7
222
255
  signing_key:
223
256
  specification_version: 3
224
257
  summary: A minimalist Ruby framework for small, static sites