engine_of_war 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Guardfile ADDED
@@ -0,0 +1,18 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^spec/.+_spec\.rb$})
11
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
12
+ watch('spec/spec_helper.rb') { "spec" }
13
+ end
14
+
15
+ guard 'bundler' do
16
+ watch('Gemfile')
17
+ watch(/^.+\\.gemspec/)
18
+ end
@@ -30,5 +30,7 @@ Gem::Specification.new do |gem|
30
30
  gem.add_development_dependency "rake"
31
31
  gem.add_development_dependency "rspec"
32
32
  gem.add_development_dependency "capybara"
33
-
33
+ gem.add_development_dependency 'guard-rspec'
34
+ gem.add_development_dependency "guard-bundler"
35
+ gem.add_development_dependency 'ruby_gntp'
34
36
  end
@@ -7,12 +7,13 @@ class EngineOfWar::App < Sinatra::Base
7
7
  config.sass_dir = 'views/css'
8
8
  end
9
9
 
10
- set :haml, { :format => :html5 }
11
- set :scss, Compass.sass_engine_options
12
- set(:config) { File.expand_path(root + '/config/') }
10
+ set :haml, format: :html5
11
+ set :scss, Compass.sass_engine_options
12
+ set :github_info, nil
13
+ set(:config) { File.expand_path(root + '/config/') }
13
14
 
14
15
  def render_page_with_layout(page)
15
- render_page(page, :layout => "layouts/#{page.layout}", :layout_engine => :haml)
16
+ render_page(page, layout: "layouts/#{page.layout}", layout_engine: :haml)
16
17
  end
17
18
 
18
19
  get "/posts.atom" do
@@ -1,10 +1,11 @@
1
1
  class EngineOfWar::Page
2
2
  YAML_REGEXP = /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
3
3
 
4
- attr_reader :request_path, :views_root, :meta, :source
4
+ attr_reader :request_path, :views_root, :root, :meta, :source
5
5
 
6
6
  def initialize(request_path)
7
7
  @views_root = EngineOfWar::App.settings.views
8
+ @root = EngineOfWar::App.settings.root
8
9
  @request_path = normalize_path(request_path)
9
10
  @entire_source = File.read(template_path)
10
11
  @meta, @source = split_body
@@ -23,8 +24,11 @@ class EngineOfWar::Page
23
24
  end
24
25
 
25
26
  def github_edit_url
26
- relative_template_path = template_path.sub(views_root, "views")
27
- "https://github.com/thunderboltlabs/thunderboltlabs/edit/master/#{relative_template_path}"
27
+ snippet = EngineOfWar::App.settings.github_info
28
+ if snippet.blank?
29
+ raise RuntimeError, "We don't know your github info. Fix with: EngineOfWar::App.set :github_info, 'foo/bar'"
30
+ end
31
+ "https://github.com/#{snippet}/edit/master#{template_path.sub(root, '')}"
28
32
  end
29
33
 
30
34
  private
@@ -1,3 +1,3 @@
1
1
  module EngineOfWar
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/spec/page_spec.rb CHANGED
@@ -25,7 +25,20 @@ describe "Given a textile file without frontmatter, Page" do
25
25
  subject { @page }
26
26
 
27
27
  its(:engine) { should == :textile }
28
- its(:github_edit_url) { should == "https://github.com/thunderboltlabs/thunderboltlabs/edit/master/views/file.html.textile" }
28
+
29
+ context "when github is configured" do
30
+ before { EngineOfWar::App.set :github_info, "foo/bar" }
31
+ its(:github_edit_url) do
32
+ should == "https://github.com/foo/bar/edit/master/views/file.html.textile"
33
+ end
34
+ end
35
+
36
+ context "when github is not configured" do
37
+ before { EngineOfWar::App.set :github_info, nil }
38
+ it ".github_edit_url should raise" do
39
+ lambda { subject.github_edit_url }.should raise_error
40
+ end
41
+ end
29
42
  end
30
43
 
31
44
  describe "Given a file with front matter" do
@@ -49,7 +62,6 @@ describe "Given a file with front matter" do
49
62
  its(:url) { should == "/file" }
50
63
  its(:source) { should match("%h1 This is a post.") }
51
64
  its(:source) { should_not match("Title for this post") }
52
- its(:github_edit_url) { should == "https://github.com/thunderboltlabs/thunderboltlabs/edit/master/views/file.html.haml" }
53
65
 
54
66
  describe "#meta" do
55
67
  before { @out = @page.meta }
@@ -71,7 +83,12 @@ describe "Given a file with front matter" do
71
83
  its(:url) { should == "/file" }
72
84
  its(:source) { should match("%h1 This is a post.") }
73
85
  its(:source) { should_not match("Title for this post") }
74
- its(:github_edit_url) { should == "https://github.com/thunderboltlabs/thunderboltlabs/edit/master/views/file.html.haml" }
86
+ context "when github is configured" do
87
+ before { EngineOfWar::App.set :github_info, "foo/bar" }
88
+ its(:github_edit_url) do
89
+ should == "https://github.com/foo/bar/edit/master/views/file.html.haml"
90
+ end
91
+ end
75
92
  end
76
93
  end
77
94
 
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: 1.0.0
4
+ version: 1.0.1
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-11-24 00:00:00.000000000 Z
12
+ date: 2011-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &70328295027160 !ruby/object:Gem::Requirement
16
+ requirement: &70278387274160 !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: *70328295027160
24
+ version_requirements: *70278387274160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: compass
27
- requirement: &70328295024960 !ruby/object:Gem::Requirement
27
+ requirement: &70278387273260 !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: *70328295024960
35
+ version_requirements: *70278387273260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: padrino
38
- requirement: &70328295019900 !ruby/object:Gem::Requirement
38
+ requirement: &70278387272520 !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: *70328295019900
46
+ version_requirements: *70278387272520
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: active_support
49
- requirement: &70328295041040 !ruby/object:Gem::Requirement
49
+ requirement: &70278387271780 !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: *70328295041040
57
+ version_requirements: *70278387271780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: builder
60
- requirement: &70328295039720 !ruby/object:Gem::Requirement
60
+ requirement: &70278387270780 !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: *70328295039720
68
+ version_requirements: *70278387270780
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: haml
71
- requirement: &70328295038900 !ruby/object:Gem::Requirement
71
+ requirement: &70278387269620 !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: *70328295038900
79
+ version_requirements: *70278387269620
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sass
82
- requirement: &70328295036580 !ruby/object:Gem::Requirement
82
+ requirement: &70278387268420 !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: *70328295036580
90
+ version_requirements: *70278387268420
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: RedCloth
93
- requirement: &70328295103560 !ruby/object:Gem::Requirement
93
+ requirement: &70278387267600 !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: *70328295103560
101
+ version_requirements: *70278387267600
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: coffee-script
104
- requirement: &70328295102900 !ruby/object:Gem::Requirement
104
+ requirement: &70278386758180 !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: *70328295102900
112
+ version_requirements: *70278386758180
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: yard
115
- requirement: &70328295101840 !ruby/object:Gem::Requirement
115
+ requirement: &70278386757220 !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: :development
122
122
  prerelease: false
123
- version_requirements: *70328295101840
123
+ version_requirements: *70278386757220
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: RedCloth
126
- requirement: &70328295100320 !ruby/object:Gem::Requirement
126
+ requirement: &70278386755780 !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: :development
133
133
  prerelease: false
134
- version_requirements: *70328295100320
134
+ version_requirements: *70278386755780
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: rake
137
- requirement: &70328295098420 !ruby/object:Gem::Requirement
137
+ requirement: &70278386755180 !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: :development
144
144
  prerelease: false
145
- version_requirements: *70328295098420
145
+ version_requirements: *70278386755180
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: rspec
148
- requirement: &70328295129660 !ruby/object:Gem::Requirement
148
+ requirement: &70278386754540 !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: :development
155
155
  prerelease: false
156
- version_requirements: *70328295129660
156
+ version_requirements: *70278386754540
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: capybara
159
- requirement: &70328295128780 !ruby/object:Gem::Requirement
159
+ requirement: &70278386753840 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,7 +164,40 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *70328295128780
167
+ version_requirements: *70278386753840
168
+ - !ruby/object:Gem::Dependency
169
+ name: guard-rspec
170
+ requirement: &70278386752820 !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: *70278386752820
179
+ - !ruby/object:Gem::Dependency
180
+ name: guard-bundler
181
+ requirement: &70278386752220 !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: *70278386752220
190
+ - !ruby/object:Gem::Dependency
191
+ name: ruby_gntp
192
+ requirement: &70278386751620 !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: *70278386751620
168
201
  description: Semi-static site engine.
169
202
  email:
170
203
  - us@thunderboltlabs.com
@@ -174,8 +207,10 @@ extra_rdoc_files: []
174
207
  files:
175
208
  - .gitignore
176
209
  - .rbenv-version
210
+ - .rspec
177
211
  - .yardopts
178
212
  - Gemfile
213
+ - Guardfile
179
214
  - Rakefile
180
215
  - Readme.textile
181
216
  - engine_of_war.gemspec
@@ -214,7 +249,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
249
  version: '0'
215
250
  segments:
216
251
  - 0
217
- hash: -3834429473079720226
252
+ hash: 355864320943180861
218
253
  required_rubygems_version: !ruby/object:Gem::Requirement
219
254
  none: false
220
255
  requirements:
@@ -223,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
258
  version: '0'
224
259
  segments:
225
260
  - 0
226
- hash: -3834429473079720226
261
+ hash: 355864320943180861
227
262
  requirements: []
228
263
  rubyforge_project:
229
264
  rubygems_version: 1.8.11