middleman 2.0.0.beta3 → 2.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/features/helpers_auto_javascript_include_tag.feature +27 -0
- data/features/helpers_auto_stylesheet_link_tag.feature +14 -4
- data/fixtures/test-app/config.rb +20 -7
- data/fixtures/test-app/source/auto-js.html.haml +1 -0
- data/fixtures/test-app/source/javascripts/auto-js.js +1 -0
- data/fixtures/test-app/source/javascripts/auto-js/auto-js.js +1 -0
- data/fixtures/test-app/source/javascripts/auto-js/index.js +1 -0
- data/fixtures/test-app/source/javascripts/auto-js/sub/auto-js.js +1 -0
- data/fixtures/test-app/source/stylesheets/{sub1 → auto-css}/auto-css.css +0 -0
- data/fixtures/test-app/source/stylesheets/{sub1/sub2/auto-css.css → auto-css/index.css} +0 -0
- data/fixtures/test-app/source/stylesheets/auto-css/sub/auto-css.css +0 -0
- data/lib/middleman.rb +1 -1
- data/lib/middleman/features/default_helpers.rb +26 -12
- data/lib/middleman/version.rb +1 -1
- data/middleman.gemspec +1 -0
- metadata +38 -11
data/.gitignore
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: Built-in auto_javascript_include_tag view helper
|
2
|
+
In order to simplify including javascript files
|
3
|
+
|
4
|
+
Scenario: Viewing the root path
|
5
|
+
Given the Server is running
|
6
|
+
When I go to "/auto-js.html"
|
7
|
+
Then I should see "javascripts/auto-js.js"
|
8
|
+
|
9
|
+
Scenario: Viewing a tier-1 path
|
10
|
+
Given the Server is running
|
11
|
+
When I go to "/auto-js/auto-js.html"
|
12
|
+
Then I should see "javascripts/auto-js/auto-js.js"
|
13
|
+
|
14
|
+
Scenario: Viewing the index file of a tier-1 path, without filename
|
15
|
+
Given the Server is running
|
16
|
+
When I go to "/auto-js"
|
17
|
+
Then I should see "javascripts/auto-js/index.js"
|
18
|
+
|
19
|
+
Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
|
20
|
+
Given the Server is running
|
21
|
+
When I go to "/auto-js/"
|
22
|
+
Then I should see "javascripts/auto-js/index.js"
|
23
|
+
|
24
|
+
Scenario: Viewing a tier-2 path
|
25
|
+
Given the Server is running
|
26
|
+
When I go to "/auto-js/sub/auto-js.html"
|
27
|
+
Then I should see "javascripts/auto-js/sub/auto-js.js"
|
@@ -8,10 +8,20 @@ Feature: Built-in auto_stylesheet_link_tag view helper
|
|
8
8
|
|
9
9
|
Scenario: Viewing a tier-1 path
|
10
10
|
Given the Server is running
|
11
|
-
When I go to "/
|
12
|
-
Then I should see "stylesheets/
|
11
|
+
When I go to "/auto-css/auto-css.html"
|
12
|
+
Then I should see "stylesheets/auto-css/auto-css.css"
|
13
|
+
|
14
|
+
Scenario: Viewing the index file of a tier-1 path, without filename
|
15
|
+
Given the Server is running
|
16
|
+
When I go to "/auto-css"
|
17
|
+
Then I should see "stylesheets/auto-css/index.css"
|
18
|
+
|
19
|
+
Scenario: Viewing the index file of a tier-1 path, without filename, with a trailing slash
|
20
|
+
Given the Server is running
|
21
|
+
When I go to "/auto-css/"
|
22
|
+
Then I should see "stylesheets/auto-css/index.css"
|
13
23
|
|
14
24
|
Scenario: Viewing a tier-2 path
|
15
25
|
Given the Server is running
|
16
|
-
When I go to "/
|
17
|
-
Then I should see "stylesheets/
|
26
|
+
When I go to "/auto-css/sub/auto-css.html"
|
27
|
+
Then I should see "stylesheets/auto-css/sub/auto-css.css"
|
data/fixtures/test-app/config.rb
CHANGED
@@ -17,14 +17,27 @@ get "/sub1/sub2/page-class.html" do
|
|
17
17
|
haml :"page-classes.html", :layout => false
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
%w{
|
21
|
+
/auto-css.html
|
22
|
+
/auto-css
|
23
|
+
/auto-css/
|
24
|
+
/auto-css/auto-css.html
|
25
|
+
/auto-css/sub/auto-css.html
|
26
|
+
}.each do |path|
|
27
|
+
get path do
|
28
|
+
haml :"auto-css.html", :layout => false
|
29
|
+
end
|
22
30
|
end
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
%w{
|
33
|
+
/auto-js.html
|
34
|
+
/auto-js
|
35
|
+
/auto-js/
|
36
|
+
/auto-js/auto-js.html
|
37
|
+
/auto-js/sub/auto-js.html
|
38
|
+
}.each do |path|
|
39
|
+
get path do
|
40
|
+
haml :"auto-js.html", :layout => false
|
41
|
+
end
|
26
42
|
end
|
27
43
|
|
28
|
-
get "/sub1/sub2/auto-css.html" do
|
29
|
-
haml :"auto-css.html", :layout => false
|
30
|
-
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_javascript_include_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
File without changes
|
File without changes
|
File without changes
|
data/lib/middleman.rb
CHANGED
@@ -8,22 +8,36 @@ module Middleman::Features::DefaultHelpers
|
|
8
8
|
|
9
9
|
module Helpers
|
10
10
|
def auto_stylesheet_link_tag(separator="/")
|
11
|
+
auto_tag(:css, separator) do |path|
|
12
|
+
stylesheet_link_tag path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def auto_javascript_include_tag(separator="/")
|
17
|
+
auto_tag(:js, separator) do |path|
|
18
|
+
javascript_include_tag path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def auto_tag(asset_ext, separator="/", asset_dir=nil)
|
23
|
+
if asset_dir.nil?
|
24
|
+
asset_dir = case asset_ext
|
25
|
+
when :js then self.class.js_dir
|
26
|
+
when :css then self.class.css_dir
|
27
|
+
end
|
28
|
+
end
|
11
29
|
path = request.path_info.dup
|
12
|
-
|
30
|
+
# If the basename of the request as no extension, assume we are serving a
|
31
|
+
# directory and join index_file to the path.
|
32
|
+
path = File.join(path, self.class.index_file) if File.extname(path).empty?
|
13
33
|
path = path.gsub(%r{^/}, '')
|
14
|
-
path = path.gsub(File.extname(path),
|
34
|
+
path = path.gsub(File.extname(path), ".#{asset_ext}")
|
15
35
|
path = path.gsub("/", separator)
|
16
36
|
|
17
|
-
|
18
|
-
|
19
|
-
scss_file = File.join(self.class.views, self.class.css_dir, "#{path}.css.scss")
|
20
|
-
less_file = File.join(self.class.views, self.class.css_dir, "#{path}.css.less")
|
21
|
-
|
22
|
-
if File.exists?(css_file) || File.exists?(sass_file) || File.exists?(scss_file) || File.exists?(less_file)
|
23
|
-
stylesheet_link_tag "#{path}.css"
|
24
|
-
end
|
37
|
+
view = File.join(self.class.views, asset_dir, path)
|
38
|
+
yield path if File.exists?(view) or Dir["#{view}.*"].any?
|
25
39
|
end
|
26
|
-
|
40
|
+
|
27
41
|
def page_classes
|
28
42
|
path = request.path_info.dup
|
29
43
|
path << settings.index_file if path.match(%r{/$})
|
@@ -58,4 +72,4 @@ module Middleman::Features::DefaultHelpers
|
|
58
72
|
"#{result_path}#{timestamp}"
|
59
73
|
end
|
60
74
|
end
|
61
|
-
end
|
75
|
+
end
|
data/lib/middleman/version.rb
CHANGED
data/middleman.gemspec
CHANGED
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_runtime_dependency("coffee-script", ["~> 2.2.0"])
|
37
37
|
s.add_runtime_dependency("httparty", ["~> 0.7.0"])
|
38
38
|
s.add_development_dependency("cucumber", ["~> 0.10.0"])
|
39
|
+
s.add_development_dependency("rake", ["0.8.7"])
|
39
40
|
s.add_development_dependency("rspec", [">= 0"])
|
40
41
|
s.add_development_dependency("rocco", [">= 0"]) unless defined?(JRUBY_VERSION)
|
41
42
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 2.0.0.
|
5
|
+
version: 2.0.0.beta4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thomas Reynolds
|
@@ -10,7 +10,8 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-24 00:00:00 -07:00
|
14
|
+
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rack
|
@@ -211,18 +212,18 @@ dependencies:
|
|
211
212
|
type: :development
|
212
213
|
version_requirements: *id018
|
213
214
|
- !ruby/object:Gem::Dependency
|
214
|
-
name:
|
215
|
+
name: rake
|
215
216
|
prerelease: false
|
216
217
|
requirement: &id019 !ruby/object:Gem::Requirement
|
217
218
|
none: false
|
218
219
|
requirements:
|
219
|
-
- - "
|
220
|
+
- - "="
|
220
221
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
222
|
+
version: 0.8.7
|
222
223
|
type: :development
|
223
224
|
version_requirements: *id019
|
224
225
|
- !ruby/object:Gem::Dependency
|
225
|
-
name:
|
226
|
+
name: rspec
|
226
227
|
prerelease: false
|
227
228
|
requirement: &id020 !ruby/object:Gem::Requirement
|
228
229
|
none: false
|
@@ -232,6 +233,17 @@ dependencies:
|
|
232
233
|
version: "0"
|
233
234
|
type: :development
|
234
235
|
version_requirements: *id020
|
236
|
+
- !ruby/object:Gem::Dependency
|
237
|
+
name: rocco
|
238
|
+
prerelease: false
|
239
|
+
requirement: &id021 !ruby/object:Gem::Requirement
|
240
|
+
none: false
|
241
|
+
requirements:
|
242
|
+
- - ">="
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: "0"
|
245
|
+
type: :development
|
246
|
+
version_requirements: *id021
|
235
247
|
description:
|
236
248
|
email:
|
237
249
|
- tdreyno@gmail.com
|
@@ -259,6 +271,7 @@ files:
|
|
259
271
|
- features/builder.feature
|
260
272
|
- features/coffee-script.feature
|
261
273
|
- features/generator.feature
|
274
|
+
- features/helpers_auto_javascript_include_tag.feature
|
262
275
|
- features/helpers_auto_stylesheet_link_tag.feature
|
263
276
|
- features/helpers_page_classes.feature
|
264
277
|
- features/minify_css.feature
|
@@ -283,6 +296,7 @@ files:
|
|
283
296
|
- fixtures/test-app/source/asset_host.html.haml
|
284
297
|
- fixtures/test-app/source/auto-css.html.haml
|
285
298
|
- fixtures/test-app/source/auto-image-sizes.html.haml
|
299
|
+
- fixtures/test-app/source/auto-js.html.haml
|
286
300
|
- fixtures/test-app/source/cache-buster.html.haml
|
287
301
|
- fixtures/test-app/source/custom-layout-dir/index.html.haml
|
288
302
|
- fixtures/test-app/source/custom-layout.html.haml
|
@@ -292,6 +306,10 @@ files:
|
|
292
306
|
- fixtures/test-app/source/inline-coffeescript.html.haml
|
293
307
|
- fixtures/test-app/source/inline-css.html.haml
|
294
308
|
- fixtures/test-app/source/inline-js.html.haml
|
309
|
+
- fixtures/test-app/source/javascripts/auto-js.js
|
310
|
+
- fixtures/test-app/source/javascripts/auto-js/auto-js.js
|
311
|
+
- fixtures/test-app/source/javascripts/auto-js/index.js
|
312
|
+
- fixtures/test-app/source/javascripts/auto-js/sub/auto-js.js
|
295
313
|
- fixtures/test-app/source/javascripts/coffee_test.js.coffee
|
296
314
|
- fixtures/test-app/source/javascripts/jquery.plugin.with.dots.js
|
297
315
|
- fixtures/test-app/source/layout.haml
|
@@ -303,12 +321,13 @@ files:
|
|
303
321
|
- fixtures/test-app/source/static.html
|
304
322
|
- fixtures/test-app/source/stylesheets/asset_host.css.sass
|
305
323
|
- fixtures/test-app/source/stylesheets/auto-css.css
|
324
|
+
- fixtures/test-app/source/stylesheets/auto-css/auto-css.css
|
325
|
+
- fixtures/test-app/source/stylesheets/auto-css/index.css
|
326
|
+
- fixtures/test-app/source/stylesheets/auto-css/sub/auto-css.css
|
306
327
|
- fixtures/test-app/source/stylesheets/relative_assets.css.sass
|
307
328
|
- fixtures/test-app/source/stylesheets/site.css.sass
|
308
329
|
- fixtures/test-app/source/stylesheets/site_scss.css.scss
|
309
330
|
- fixtures/test-app/source/stylesheets/static.css
|
310
|
-
- fixtures/test-app/source/stylesheets/sub1/auto-css.css
|
311
|
-
- fixtures/test-app/source/stylesheets/sub1/sub2/auto-css.css
|
312
331
|
- fixtures/test-app/source/tiny_src.html.haml
|
313
332
|
- lib/middleman.rb
|
314
333
|
- lib/middleman/assets.rb
|
@@ -374,6 +393,7 @@ files:
|
|
374
393
|
- lib/middleman/templates/xhtml/source/stylesheets/site.css.sass
|
375
394
|
- lib/middleman/version.rb
|
376
395
|
- middleman.gemspec
|
396
|
+
has_rdoc: true
|
377
397
|
homepage: http://wiki.github.com/tdreyno/middleman
|
378
398
|
licenses: []
|
379
399
|
|
@@ -397,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
397
417
|
requirements: []
|
398
418
|
|
399
419
|
rubyforge_project: middleman
|
400
|
-
rubygems_version: 1.
|
420
|
+
rubygems_version: 1.3.9.2
|
401
421
|
signing_key:
|
402
422
|
specification_version: 3
|
403
423
|
summary: A static site generator based on Sinatra. Providing Haml, Sass, Compass, Less, Coffee Script and including minification, compression and cache busting.
|
@@ -405,6 +425,7 @@ test_files:
|
|
405
425
|
- features/builder.feature
|
406
426
|
- features/coffee-script.feature
|
407
427
|
- features/generator.feature
|
428
|
+
- features/helpers_auto_javascript_include_tag.feature
|
408
429
|
- features/helpers_auto_stylesheet_link_tag.feature
|
409
430
|
- features/helpers_page_classes.feature
|
410
431
|
- features/minify_css.feature
|
@@ -429,6 +450,7 @@ test_files:
|
|
429
450
|
- fixtures/test-app/source/asset_host.html.haml
|
430
451
|
- fixtures/test-app/source/auto-css.html.haml
|
431
452
|
- fixtures/test-app/source/auto-image-sizes.html.haml
|
453
|
+
- fixtures/test-app/source/auto-js.html.haml
|
432
454
|
- fixtures/test-app/source/cache-buster.html.haml
|
433
455
|
- fixtures/test-app/source/custom-layout-dir/index.html.haml
|
434
456
|
- fixtures/test-app/source/custom-layout.html.haml
|
@@ -438,6 +460,10 @@ test_files:
|
|
438
460
|
- fixtures/test-app/source/inline-coffeescript.html.haml
|
439
461
|
- fixtures/test-app/source/inline-css.html.haml
|
440
462
|
- fixtures/test-app/source/inline-js.html.haml
|
463
|
+
- fixtures/test-app/source/javascripts/auto-js.js
|
464
|
+
- fixtures/test-app/source/javascripts/auto-js/auto-js.js
|
465
|
+
- fixtures/test-app/source/javascripts/auto-js/index.js
|
466
|
+
- fixtures/test-app/source/javascripts/auto-js/sub/auto-js.js
|
441
467
|
- fixtures/test-app/source/javascripts/coffee_test.js.coffee
|
442
468
|
- fixtures/test-app/source/javascripts/jquery.plugin.with.dots.js
|
443
469
|
- fixtures/test-app/source/layout.haml
|
@@ -449,10 +475,11 @@ test_files:
|
|
449
475
|
- fixtures/test-app/source/static.html
|
450
476
|
- fixtures/test-app/source/stylesheets/asset_host.css.sass
|
451
477
|
- fixtures/test-app/source/stylesheets/auto-css.css
|
478
|
+
- fixtures/test-app/source/stylesheets/auto-css/auto-css.css
|
479
|
+
- fixtures/test-app/source/stylesheets/auto-css/index.css
|
480
|
+
- fixtures/test-app/source/stylesheets/auto-css/sub/auto-css.css
|
452
481
|
- fixtures/test-app/source/stylesheets/relative_assets.css.sass
|
453
482
|
- fixtures/test-app/source/stylesheets/site.css.sass
|
454
483
|
- fixtures/test-app/source/stylesheets/site_scss.css.scss
|
455
484
|
- fixtures/test-app/source/stylesheets/static.css
|
456
|
-
- fixtures/test-app/source/stylesheets/sub1/auto-css.css
|
457
|
-
- fixtures/test-app/source/stylesheets/sub1/sub2/auto-css.css
|
458
485
|
- fixtures/test-app/source/tiny_src.html.haml
|