engine_of_war 1.6.5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +32 -0
- data/engine_of_war.gemspec +1 -0
- data/lib/engine_of_war.rb +1 -1
- data/lib/engine_of_war/app.rb +6 -2
- data/lib/engine_of_war/version.rb +1 -1
- data/spec/data_spec.rb +34 -0
- data/spec/spec_helper.rb +6 -11
- metadata +62 -52
- data/Readme.textile +0 -0
- data/lib/engine_of_war/recommendation.rb +0 -34
- data/spec/recommendations_spec.rb +0 -44
data/Readme.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
== Engine of War
|
2
|
+
|
3
|
+
Static(ish) site engine extracted from "thunderboltlabs.com":http://thunderboltlabs.com and "tammersaleh.com":http://tammersaleh.com.
|
4
|
+
|
5
|
+
=== Installation
|
6
|
+
|
7
|
+
``` ruby
|
8
|
+
# Gemfile
|
9
|
+
gem 'engine_of_war'
|
10
|
+
```
|
11
|
+
|
12
|
+
``` ruby
|
13
|
+
# config.ru
|
14
|
+
Encoding.default_external = Encoding::UTF_8
|
15
|
+
Encoding.default_internal = Encoding::UTF_8
|
16
|
+
|
17
|
+
require 'engine_of_war'
|
18
|
+
|
19
|
+
YAML::ENGINE.yamler = 'syck' # Heroku doesn't support 'psych'
|
20
|
+
|
21
|
+
EngineOfWar::App.root = File.dirname(__FILE__)
|
22
|
+
EngineOfWar::App.github_info = "thunderboltlabs/thunderboltlabs"
|
23
|
+
EngineOfWar::App.site_title = "Thunderbolt Labs"
|
24
|
+
EngineOfWar::App.google_analytics_key = "UA-xxxxxxxx-1"
|
25
|
+
EngineOfWar::App.gauges_key = "xxxxxxxxxxxxxxxxxxxxxxxx"
|
26
|
+
EngineOfWar::App.newrelic_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
27
|
+
|
28
|
+
run EngineOfWar::App
|
29
|
+
```
|
30
|
+
|
31
|
+
=== Layout
|
32
|
+
|
data/engine_of_war.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_dependency "rack-gauges"
|
30
30
|
gem.add_dependency 'rpm_contrib'
|
31
31
|
gem.add_dependency 'newrelic_rpm'
|
32
|
+
gem.add_dependency 'deep_struct', ">= 1.1.0"
|
32
33
|
|
33
34
|
gem.add_development_dependency "yard"
|
34
35
|
gem.add_development_dependency "rake"
|
data/lib/engine_of_war.rb
CHANGED
@@ -13,6 +13,7 @@ require 'active_support/hash_with_indifferent_access'
|
|
13
13
|
require 'active_support/core_ext/object/blank'
|
14
14
|
require 'date'
|
15
15
|
require 'json'
|
16
|
+
require 'deep_struct'
|
16
17
|
|
17
18
|
module EngineOfWar; end
|
18
19
|
|
@@ -24,6 +25,5 @@ require 'engine_of_war/template_engines/markdown'
|
|
24
25
|
require 'engine_of_war/layout'
|
25
26
|
require 'engine_of_war/page'
|
26
27
|
require 'engine_of_war/page_collection'
|
27
|
-
require 'engine_of_war/recommendation'
|
28
28
|
require 'engine_of_war/app'
|
29
29
|
|
data/lib/engine_of_war/app.rb
CHANGED
@@ -13,8 +13,8 @@ class EngineOfWar::App < Sinatra::Base
|
|
13
13
|
set :github_info, nil
|
14
14
|
set :site_title, nil
|
15
15
|
|
16
|
-
set :
|
17
|
-
File.expand_path(root + '/
|
16
|
+
set :data_root do
|
17
|
+
File.expand_path(root + '/data/')
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.google_analytics_key=(key)
|
@@ -64,6 +64,10 @@ class EngineOfWar::App < Sinatra::Base
|
|
64
64
|
def collection(dir)
|
65
65
|
EngineOfWar::PageCollection.new(dir)
|
66
66
|
end
|
67
|
+
|
68
|
+
def data(file)
|
69
|
+
DeepStruct.from_file(File.join(settings.data_root, file))
|
70
|
+
end
|
67
71
|
end
|
68
72
|
|
69
73
|
error(500) { haml :"500" }
|
data/spec/data_spec.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/bin/env rspec
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe "Given a page that uses data" do
|
6
|
+
before do
|
7
|
+
create_data("people.json", '[{"name": "Bob"}, {"name": "Sue"}]')
|
8
|
+
|
9
|
+
create_template("layouts/application.html.haml",
|
10
|
+
<<-EOF)
|
11
|
+
%h1 Application Layout
|
12
|
+
= yield
|
13
|
+
EOF
|
14
|
+
|
15
|
+
create_template("people.html.haml",
|
16
|
+
<<-EOF)
|
17
|
+
- data("people.json").each do |person|
|
18
|
+
%h2= person.name
|
19
|
+
%h3= data("people.json").sample.name
|
20
|
+
EOF
|
21
|
+
end
|
22
|
+
|
23
|
+
context "GET /people" do
|
24
|
+
before { visit "/people" }
|
25
|
+
|
26
|
+
it "renders the first person" do
|
27
|
+
page.should have_selector('h2:contains("Bob")')
|
28
|
+
end
|
29
|
+
|
30
|
+
it "renders the second person" do
|
31
|
+
page.should have_selector('h2:contains("Sue")')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,8 @@ require "engine_of_war.rb"
|
|
7
7
|
|
8
8
|
Capybara.app = EngineOfWar::App
|
9
9
|
Capybara.app.set :root, "/tmp/engine-#{$$}"
|
10
|
+
Capybara.app.enable :raise_errors
|
11
|
+
Capybara.app.enable :show_exceptions
|
10
12
|
FakeWeb.allow_net_connect = false
|
11
13
|
|
12
14
|
def create_template(path, content)
|
@@ -17,8 +19,8 @@ def create_asset(path, content)
|
|
17
19
|
create_file "#{Capybara.app.settings.public_folder}/#{path}", content.unindent
|
18
20
|
end
|
19
21
|
|
20
|
-
def
|
21
|
-
create_file "#{Capybara.app.settings.
|
22
|
+
def create_data(path, content)
|
23
|
+
create_file "#{Capybara.app.settings.data_root}/#{path}", content.unindent
|
22
24
|
end
|
23
25
|
|
24
26
|
def create_file(path, content)
|
@@ -35,25 +37,18 @@ end
|
|
35
37
|
def create_dirs
|
36
38
|
FileUtils.mkdir_p(Capybara.app.settings.views)
|
37
39
|
FileUtils.mkdir_p(Capybara.app.settings.public_folder)
|
38
|
-
FileUtils.mkdir_p(Capybara.app.settings.config)
|
39
40
|
end
|
40
41
|
|
41
42
|
def remove_dirs
|
42
43
|
FileUtils.rm_rf(Capybara.app.settings.views)
|
43
44
|
FileUtils.rm_rf(Capybara.app.settings.public_folder)
|
44
|
-
FileUtils.rm_rf(Capybara.app.settings.config)
|
45
45
|
end
|
46
46
|
|
47
47
|
RSpec.configure do |config|
|
48
48
|
config.include Capybara::DSL
|
49
49
|
|
50
|
-
config.before(:all)
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
config.after(:all) do
|
55
|
-
remove_dirs
|
56
|
-
end
|
50
|
+
config.before(:all) { create_dirs }
|
51
|
+
config.after(:all) { remove_dirs }
|
57
52
|
|
58
53
|
config.before(:each) do
|
59
54
|
remove_dirs
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engine_of_war
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
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: 2012-
|
12
|
+
date: 2012-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
16
|
-
requirement: &
|
16
|
+
requirement: &70126019912240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70126019912240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: compass
|
27
|
-
requirement: &
|
27
|
+
requirement: &70126019999780 !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: *
|
35
|
+
version_requirements: *70126019999780
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: padrino
|
38
|
-
requirement: &
|
38
|
+
requirement: &70126019998380 !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: *
|
46
|
+
version_requirements: *70126019998380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: active_support
|
49
|
-
requirement: &
|
49
|
+
requirement: &70126019997020 !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: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70126019997020
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: builder
|
60
|
-
requirement: &
|
60
|
+
requirement: &70126019993640 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70126019993640
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: haml
|
71
|
-
requirement: &
|
71
|
+
requirement: &70126019993040 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70126019993040
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: sass
|
82
|
-
requirement: &
|
82
|
+
requirement: &70126019992400 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 3.1.7
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70126019992400
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: RedCloth
|
93
|
-
requirement: &
|
93
|
+
requirement: &70126020025200 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70126020025200
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rdiscount
|
104
|
-
requirement: &
|
104
|
+
requirement: &70126020024260 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70126020024260
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: coffee-script
|
115
|
-
requirement: &
|
115
|
+
requirement: &70126020023460 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70126020023460
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rack-google-analytics
|
126
|
-
requirement: &
|
126
|
+
requirement: &70126020054580 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70126020054580
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: rack-gauges
|
137
|
-
requirement: &
|
137
|
+
requirement: &70126020053640 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70126020053640
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: rpm_contrib
|
148
|
-
requirement: &
|
148
|
+
requirement: &70126020051680 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :runtime
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *70126020051680
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: newrelic_rpm
|
159
|
-
requirement: &
|
159
|
+
requirement: &70126020050500 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,21 @@ dependencies:
|
|
164
164
|
version: '0'
|
165
165
|
type: :runtime
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *70126020050500
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: deep_struct
|
170
|
+
requirement: &70126020049720 !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: 1.1.0
|
176
|
+
type: :runtime
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: *70126020049720
|
168
179
|
- !ruby/object:Gem::Dependency
|
169
180
|
name: yard
|
170
|
-
requirement: &
|
181
|
+
requirement: &70126020048760 !ruby/object:Gem::Requirement
|
171
182
|
none: false
|
172
183
|
requirements:
|
173
184
|
- - ! '>='
|
@@ -175,10 +186,10 @@ dependencies:
|
|
175
186
|
version: '0'
|
176
187
|
type: :development
|
177
188
|
prerelease: false
|
178
|
-
version_requirements: *
|
189
|
+
version_requirements: *70126020048760
|
179
190
|
- !ruby/object:Gem::Dependency
|
180
191
|
name: rake
|
181
|
-
requirement: &
|
192
|
+
requirement: &70126020048220 !ruby/object:Gem::Requirement
|
182
193
|
none: false
|
183
194
|
requirements:
|
184
195
|
- - ! '>='
|
@@ -186,10 +197,10 @@ dependencies:
|
|
186
197
|
version: '0'
|
187
198
|
type: :development
|
188
199
|
prerelease: false
|
189
|
-
version_requirements: *
|
200
|
+
version_requirements: *70126020048220
|
190
201
|
- !ruby/object:Gem::Dependency
|
191
202
|
name: rspec
|
192
|
-
requirement: &
|
203
|
+
requirement: &70126020047580 !ruby/object:Gem::Requirement
|
193
204
|
none: false
|
194
205
|
requirements:
|
195
206
|
- - ! '>='
|
@@ -197,10 +208,10 @@ dependencies:
|
|
197
208
|
version: '0'
|
198
209
|
type: :development
|
199
210
|
prerelease: false
|
200
|
-
version_requirements: *
|
211
|
+
version_requirements: *70126020047580
|
201
212
|
- !ruby/object:Gem::Dependency
|
202
213
|
name: capybara
|
203
|
-
requirement: &
|
214
|
+
requirement: &70126020076460 !ruby/object:Gem::Requirement
|
204
215
|
none: false
|
205
216
|
requirements:
|
206
217
|
- - ! '>='
|
@@ -208,10 +219,10 @@ dependencies:
|
|
208
219
|
version: '0'
|
209
220
|
type: :development
|
210
221
|
prerelease: false
|
211
|
-
version_requirements: *
|
222
|
+
version_requirements: *70126020076460
|
212
223
|
- !ruby/object:Gem::Dependency
|
213
224
|
name: fakeweb
|
214
|
-
requirement: &
|
225
|
+
requirement: &70126020074820 !ruby/object:Gem::Requirement
|
215
226
|
none: false
|
216
227
|
requirements:
|
217
228
|
- - ! '>='
|
@@ -219,10 +230,10 @@ dependencies:
|
|
219
230
|
version: '0'
|
220
231
|
type: :development
|
221
232
|
prerelease: false
|
222
|
-
version_requirements: *
|
233
|
+
version_requirements: *70126020074820
|
223
234
|
- !ruby/object:Gem::Dependency
|
224
235
|
name: guard-rspec
|
225
|
-
requirement: &
|
236
|
+
requirement: &70126020073640 !ruby/object:Gem::Requirement
|
226
237
|
none: false
|
227
238
|
requirements:
|
228
239
|
- - ! '>='
|
@@ -230,10 +241,10 @@ dependencies:
|
|
230
241
|
version: '0'
|
231
242
|
type: :development
|
232
243
|
prerelease: false
|
233
|
-
version_requirements: *
|
244
|
+
version_requirements: *70126020073640
|
234
245
|
- !ruby/object:Gem::Dependency
|
235
246
|
name: guard-bundler
|
236
|
-
requirement: &
|
247
|
+
requirement: &70126020072660 !ruby/object:Gem::Requirement
|
237
248
|
none: false
|
238
249
|
requirements:
|
239
250
|
- - ! '>='
|
@@ -241,10 +252,10 @@ dependencies:
|
|
241
252
|
version: '0'
|
242
253
|
type: :development
|
243
254
|
prerelease: false
|
244
|
-
version_requirements: *
|
255
|
+
version_requirements: *70126020072660
|
245
256
|
- !ruby/object:Gem::Dependency
|
246
257
|
name: ruby_gntp
|
247
|
-
requirement: &
|
258
|
+
requirement: &70126020070920 !ruby/object:Gem::Requirement
|
248
259
|
none: false
|
249
260
|
requirements:
|
250
261
|
- - ! '>='
|
@@ -252,7 +263,7 @@ dependencies:
|
|
252
263
|
version: '0'
|
253
264
|
type: :development
|
254
265
|
prerelease: false
|
255
|
-
version_requirements: *
|
266
|
+
version_requirements: *70126020070920
|
256
267
|
description: Semi-static site engine.
|
257
268
|
email:
|
258
269
|
- us@thunderboltlabs.com
|
@@ -267,7 +278,7 @@ files:
|
|
267
278
|
- Gemfile
|
268
279
|
- Guardfile
|
269
280
|
- Rakefile
|
270
|
-
- Readme.
|
281
|
+
- Readme.md
|
271
282
|
- engine_of_war.gemspec
|
272
283
|
- lib/engine_of_war.rb
|
273
284
|
- lib/engine_of_war/app.rb
|
@@ -275,7 +286,6 @@ files:
|
|
275
286
|
- lib/engine_of_war/layout.rb
|
276
287
|
- lib/engine_of_war/page.rb
|
277
288
|
- lib/engine_of_war/page_collection.rb
|
278
|
-
- lib/engine_of_war/recommendation.rb
|
279
289
|
- lib/engine_of_war/template_engines/filters.rb
|
280
290
|
- lib/engine_of_war/template_engines/markdown.rb
|
281
291
|
- lib/engine_of_war/template_engines/textile.rb
|
@@ -284,12 +294,12 @@ files:
|
|
284
294
|
- spec/atom_spec.rb
|
285
295
|
- spec/blog_spec.rb
|
286
296
|
- spec/code_filter_spec.rb
|
297
|
+
- spec/data_spec.rb
|
287
298
|
- spec/error_pages_spec.rb
|
288
299
|
- spec/frontmatter_spec.rb
|
289
300
|
- spec/image_filter_spec.rb
|
290
301
|
- spec/page_collection_spec.rb
|
291
302
|
- spec/page_spec.rb
|
292
|
-
- spec/recommendations_spec.rb
|
293
303
|
- spec/rendering_spec.rb
|
294
304
|
- spec/root_spec.rb
|
295
305
|
- spec/spec_helper.rb
|
@@ -307,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
307
317
|
version: '0'
|
308
318
|
segments:
|
309
319
|
- 0
|
310
|
-
hash:
|
320
|
+
hash: 1979107136024520100
|
311
321
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
312
322
|
none: false
|
313
323
|
requirements:
|
@@ -316,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
326
|
version: '0'
|
317
327
|
segments:
|
318
328
|
- 0
|
319
|
-
hash:
|
329
|
+
hash: 1979107136024520100
|
320
330
|
requirements: []
|
321
331
|
rubyforge_project:
|
322
332
|
rubygems_version: 1.8.11
|
@@ -328,12 +338,12 @@ test_files:
|
|
328
338
|
- spec/atom_spec.rb
|
329
339
|
- spec/blog_spec.rb
|
330
340
|
- spec/code_filter_spec.rb
|
341
|
+
- spec/data_spec.rb
|
331
342
|
- spec/error_pages_spec.rb
|
332
343
|
- spec/frontmatter_spec.rb
|
333
344
|
- spec/image_filter_spec.rb
|
334
345
|
- spec/page_collection_spec.rb
|
335
346
|
- spec/page_spec.rb
|
336
|
-
- spec/recommendations_spec.rb
|
337
347
|
- spec/rendering_spec.rb
|
338
348
|
- spec/root_spec.rb
|
339
349
|
- spec/spec_helper.rb
|
data/Readme.textile
DELETED
File without changes
|
@@ -1,34 +0,0 @@
|
|
1
|
-
class EngineOfWar::Recommendation
|
2
|
-
def self.random
|
3
|
-
new(recommendations_data.sample)
|
4
|
-
end
|
5
|
-
|
6
|
-
def initialize(values = {})
|
7
|
-
@values = HashWithIndifferentAccess.new(values)
|
8
|
-
end
|
9
|
-
|
10
|
-
def method_missing(*args, &block)
|
11
|
-
if key = args.first and @values.has_key?(key)
|
12
|
-
@values[key]
|
13
|
-
else
|
14
|
-
raise NoMethodError.new("#{key} not in #{@values.inspect}")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def inspect
|
19
|
-
"Recommendation: #{@values.inspect}"
|
20
|
-
end
|
21
|
-
|
22
|
-
def to_s; inspect; end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def self.recommendations_data
|
27
|
-
JSON.parse(File.read(json_file))
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.json_file
|
31
|
-
File.join(EngineOfWar::App.settings.config, "recommendations.json")
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
#!/bin/env rspec
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "Recommendation.new(hash)" do
|
6
|
-
raw = {
|
7
|
-
:quote => "Great to work with, intelligent feedback, exceptional quality.",
|
8
|
-
:who => "Matt Todd",
|
9
|
-
:who_url => "http://www.workingwithrails.com/person/7298-matt-todd",
|
10
|
-
:where => "Working with Rails",
|
11
|
-
:where_url => "http://example.com/foo",
|
12
|
-
:position => "Developer",
|
13
|
-
:company => "GitHub",
|
14
|
-
:company_url => "http://github.com/",
|
15
|
-
:short_quote => "Short"
|
16
|
-
}
|
17
|
-
|
18
|
-
before { @recommendation = EngineOfWar::Recommendation.new(raw) }
|
19
|
-
subject { @recommendation }
|
20
|
-
|
21
|
-
raw.each do |k, v|
|
22
|
-
its(k) { should == v}
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "Recommendation.random" do
|
27
|
-
before do
|
28
|
-
create_config("recommendations.json",
|
29
|
-
<<-EOF)
|
30
|
-
[{
|
31
|
-
"quote": "Great to work with, intelligent feedback, exceptional quality.",
|
32
|
-
"who": "Matt Todd",
|
33
|
-
"who_url": "http://www.workingwithrails.com/person/7298-matt-todd",
|
34
|
-
"where_url": "http://www.workingwithrails.com/recommendation/for/person/7844-tammer-saleh",
|
35
|
-
"position": "",
|
36
|
-
"company": "GitHub",
|
37
|
-
"company_url": "http://github.com/"
|
38
|
-
}]
|
39
|
-
EOF
|
40
|
-
@recommendation = EngineOfWar::Recommendation.random
|
41
|
-
end
|
42
|
-
subject { @recommendation }
|
43
|
-
it { should be_a(EngineOfWar::Recommendation) }
|
44
|
-
end
|