massimo 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,3 @@
1
- require 'rack/utils' # needed for sinatra_more...
2
1
  require 'padrino-helpers'
3
2
 
4
3
  module Massimo
@@ -5,21 +5,19 @@ module Massimo
5
5
  class Server
6
6
  class << self
7
7
  def start(site, port = 3000)
8
- Massimo::UI.say "massimo is serving your site at http://localhost:#{port}", :growl => true
9
- trap('INT') do
10
- Massimo::UI.say 'massimo is shutting down your server', :growl => true
11
- Rack::Handler::WEBrick.shutdown
8
+ handler = Rack::Handler.default
9
+ trap(:INT) do
10
+ if handler.respond_to?(:shutdown)
11
+ handler.shutdown
12
+ else
13
+ exit
14
+ end
12
15
  end
13
-
14
- app = Rack::Builder.new do
15
- use Rack::ShowExceptions
16
- run Massimo::Server.new(site)
17
- end
18
- Rack::Handler::WEBrick.run(app, :Port => port)
16
+ handler.run(self.new(site), :Port => port)
19
17
  end
20
18
  end
21
19
 
22
- def initialize(site)
20
+ def initialize(site = Massimo.site)
23
21
  @site = site
24
22
  @file_server = Rack::File.new(site.config.output_path)
25
23
  @watcher = Massimo::Watcher.new(site)
@@ -3,7 +3,7 @@ require 'sprockets'
3
3
 
4
4
  # This is an example configuration File
5
5
  # Look here for all the available options:
6
- # http://petebrowne.github.com/massimo/configuration/
6
+ # http://massimo.petebrowne.com/configuration/
7
7
 
8
8
  if config.environment.production?
9
9
  # Use JSMin for javascript compression
@@ -0,0 +1,2 @@
1
+ require 'massimo'
2
+ run Massimo::Server.new
@@ -1,3 +1,3 @@
1
1
  module Massimo
2
- VERSION = '0.8.3'
2
+ VERSION = '0.8.4'
3
3
  end
@@ -17,7 +17,7 @@ module Massimo
17
17
  def run
18
18
  begin
19
19
  loop do
20
- process
20
+ Massimo::UI.report_errors { process }
21
21
  sleep 0.5
22
22
  end
23
23
  rescue Interrupt
@@ -27,17 +27,15 @@ module Massimo
27
27
 
28
28
  # Processes the Site if any of the files have changed.
29
29
  def process
30
- Massimo::UI.report_errors do
31
- if config_changed?
32
- Massimo::UI.say 'massimo is reloading your site'
33
- @site.reload
34
- @site.process
35
- Massimo::UI.say 'massimo has built your site', :growl => true
36
- elsif changed?
37
- Massimo::UI.say 'massimo has noticed a change'
38
- @site.process
39
- Massimo::UI.say 'massimo has built your site', :growl => true
40
- end
30
+ if config_changed?
31
+ Massimo::UI.say 'massimo is reloading your site'
32
+ @site.reload
33
+ @site.process
34
+ Massimo::UI.say 'massimo has built your site', :growl => true
35
+ elsif changed?
36
+ Massimo::UI.say 'massimo has noticed a change'
37
+ @site.process
38
+ Massimo::UI.say 'massimo has built your site', :growl => true
41
39
  end
42
40
  end
43
41
 
@@ -161,7 +161,7 @@ describe Massimo::CLI do
161
161
 
162
162
  # This is an example configuration File
163
163
  # Look here for all the available options:
164
- # http://petebrowne.github.com/massimo/configuration/
164
+ # http://massimo.petebrowne.com/configuration/
165
165
 
166
166
  if config.environment.production?
167
167
  # Use JSMin for javascript compression
@@ -179,6 +179,17 @@ describe Massimo::CLI do
179
179
  end
180
180
  end
181
181
 
182
+ it 'creates a default rackup file' do
183
+ within_construct do |c|
184
+ massimo 'generate my_site'
185
+ content = <<-EOS.unindent
186
+ require 'massimo'
187
+ run Massimo::Server.new
188
+ EOS
189
+ 'my_site/config.ru'.should be_a_file.with_content(content)
190
+ end
191
+ end
192
+
182
193
  context "with mapping 'g'" do
183
194
  it 'creates a massimo site directory' do
184
195
  within_construct do |c|
@@ -3,14 +3,14 @@ require 'spec_helper'
3
3
  describe Massimo::Server do
4
4
  let(:app) { Massimo::Server.new(Massimo.site) }
5
5
 
6
- it 'should serve up static files' do
6
+ it 'serves up static files' do
7
7
  with_file 'public/stylesheets/main.css', 'body { font-size: 12px; }' do
8
8
  get '/stylesheets/main.css'
9
9
  last_response.body.should == 'body { font-size: 12px; }'
10
10
  end
11
11
  end
12
12
 
13
- it 'should serve up directory index files' do
13
+ it 'serves up directory index files' do
14
14
  with_file 'public/about-us/index.html', 'About Us' do
15
15
  get '/about-us/'
16
16
  last_response.body.should == 'About Us'
@@ -18,7 +18,7 @@ describe Massimo::Server do
18
18
  end
19
19
 
20
20
  context 'when files have changed' do
21
- it 'should process the site on request' do
21
+ it 'processes the site on request' do
22
22
  with_file 'pages/index.haml' do
23
23
  mock(Massimo.site).process
24
24
  get '/'
@@ -27,9 +27,13 @@ describe Massimo::Server do
27
27
  end
28
28
 
29
29
  context 'when files have not changed' do
30
- it 'should not process the site on request' do
31
- dont_allow(Massimo.site).process
32
- get '/'
30
+ it 'does not process the site on request' do
31
+ with_file 'pages/index.haml' do
32
+ mock(Massimo.site).process
33
+ get '/'
34
+ dont_allow(Massimo.site).process
35
+ get '/'
36
+ end
33
37
  end
34
38
  end
35
39
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: massimo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 8
9
- - 3
10
- version: 0.8.3
8
+ - 4
9
+ version: 0.8.4
11
10
  platform: ruby
12
11
  authors:
13
12
  - Pete Browne
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-03-28 00:00:00 -05:00
17
+ date: 2011-04-09 00:00:00 -05:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 7
30
28
  segments:
31
29
  - 3
32
30
  - 0
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
- hash: 15
46
43
  segments:
47
44
  - 0
48
45
  - 4
@@ -58,7 +55,6 @@ dependencies:
58
55
  requirements:
59
56
  - - ~>
60
57
  - !ruby/object:Gem::Version
61
- hash: 31
62
58
  segments:
63
59
  - 1
64
60
  - 2
@@ -74,7 +70,6 @@ dependencies:
74
70
  requirements:
75
71
  - - ~>
76
72
  - !ruby/object:Gem::Version
77
- hash: 59
78
73
  segments:
79
74
  - 0
80
75
  - 9
@@ -90,7 +85,6 @@ dependencies:
90
85
  requirements:
91
86
  - - ~>
92
87
  - !ruby/object:Gem::Version
93
- hash: 39
94
88
  segments:
95
89
  - 0
96
90
  - 14
@@ -106,7 +100,6 @@ dependencies:
106
100
  requirements:
107
101
  - - ~>
108
102
  - !ruby/object:Gem::Version
109
- hash: 31
110
103
  segments:
111
104
  - 1
112
105
  - 2
@@ -122,7 +115,6 @@ dependencies:
122
115
  requirements:
123
116
  - - ~>
124
117
  - !ruby/object:Gem::Version
125
- hash: 19
126
118
  segments:
127
119
  - 0
128
120
  - 3
@@ -138,7 +130,6 @@ dependencies:
138
130
  requirements:
139
131
  - - ~>
140
132
  - !ruby/object:Gem::Version
141
- hash: 31
142
133
  segments:
143
134
  - 2
144
135
  - 4
@@ -154,7 +145,6 @@ dependencies:
154
145
  requirements:
155
146
  - - ~>
156
147
  - !ruby/object:Gem::Version
157
- hash: 23
158
148
  segments:
159
149
  - 1
160
150
  - 0
@@ -170,7 +160,6 @@ dependencies:
170
160
  requirements:
171
161
  - - ~>
172
162
  - !ruby/object:Gem::Version
173
- hash: 31
174
163
  segments:
175
164
  - 1
176
165
  - 2
@@ -186,7 +175,6 @@ dependencies:
186
175
  requirements:
187
176
  - - ~>
188
177
  - !ruby/object:Gem::Version
189
- hash: 11
190
178
  segments:
191
179
  - 0
192
180
  - 5
@@ -202,7 +190,6 @@ dependencies:
202
190
  requirements:
203
191
  - - ~>
204
192
  - !ruby/object:Gem::Version
205
- hash: 59
206
193
  segments:
207
194
  - 0
208
195
  - 9
@@ -218,7 +205,6 @@ dependencies:
218
205
  requirements:
219
206
  - - ~>
220
207
  - !ruby/object:Gem::Version
221
- hash: 7
222
208
  segments:
223
209
  - 3
224
210
  - 0
@@ -234,7 +220,6 @@ dependencies:
234
220
  requirements:
235
221
  - - ~>
236
222
  - !ruby/object:Gem::Version
237
- hash: 31
238
223
  segments:
239
224
  - 1
240
225
  - 2
@@ -250,7 +235,6 @@ dependencies:
250
235
  requirements:
251
236
  - - ~>
252
237
  - !ruby/object:Gem::Version
253
- hash: 19
254
238
  segments:
255
239
  - 0
256
240
  - 3
@@ -266,7 +250,6 @@ dependencies:
266
250
  requirements:
267
251
  - - ~>
268
252
  - !ruby/object:Gem::Version
269
- hash: 23
270
253
  segments:
271
254
  - 1
272
255
  - 0
@@ -282,7 +265,6 @@ dependencies:
282
265
  requirements:
283
266
  - - ~>
284
267
  - !ruby/object:Gem::Version
285
- hash: 23
286
268
  segments:
287
269
  - 1
288
270
  - 0
@@ -298,7 +280,6 @@ dependencies:
298
280
  requirements:
299
281
  - - ~>
300
282
  - !ruby/object:Gem::Version
301
- hash: 3
302
283
  segments:
303
284
  - 3
304
285
  - 1
@@ -314,7 +295,6 @@ dependencies:
314
295
  requirements:
315
296
  - - ~>
316
297
  - !ruby/object:Gem::Version
317
- hash: 59
318
298
  segments:
319
299
  - 0
320
300
  - 9
@@ -330,7 +310,6 @@ dependencies:
330
310
  requirements:
331
311
  - - ~>
332
312
  - !ruby/object:Gem::Version
333
- hash: 19
334
313
  segments:
335
314
  - 0
336
315
  - 3
@@ -346,7 +325,6 @@ dependencies:
346
325
  requirements:
347
326
  - - ~>
348
327
  - !ruby/object:Gem::Version
349
- hash: 23
350
328
  segments:
351
329
  - 1
352
330
  - 0
@@ -382,6 +360,7 @@ files:
382
360
  - lib/massimo/site.rb
383
361
  - lib/massimo/stylesheet.rb
384
362
  - lib/massimo/templates/site/config.rb
363
+ - lib/massimo/templates/site/config.ru
385
364
  - lib/massimo/templates/site/javascripts/main.js
386
365
  - lib/massimo/templates/site/pages/index.erb
387
366
  - lib/massimo/templates/site/public/.empty_directory
@@ -423,7 +402,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
423
402
  requirements:
424
403
  - - ">="
425
404
  - !ruby/object:Gem::Version
426
- hash: 3
427
405
  segments:
428
406
  - 0
429
407
  version: "0"
@@ -432,7 +410,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
432
410
  requirements:
433
411
  - - ">="
434
412
  - !ruby/object:Gem::Version
435
- hash: 3
436
413
  segments:
437
414
  - 0
438
415
  version: "0"