middleman 0.10.6 → 0.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/middleman/helpers.rb +3 -3
- data/middleman.gemspec +2 -1
- data/spec/fixtures/sample/init.rb +25 -0
- data/spec/helpers_spec.rb +45 -0
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.7
|
data/lib/middleman/helpers.rb
CHANGED
@@ -16,10 +16,10 @@ module Middleman
|
|
16
16
|
path << self.class.index_file if path.match(%r{/$})
|
17
17
|
path = path.gsub(%r{^/}, '')
|
18
18
|
path = path.gsub(File.extname(path), '')
|
19
|
-
path = path.gsub('/', '-')
|
20
19
|
|
21
|
-
css_file = File.join(
|
22
|
-
sass_file = File.join(
|
20
|
+
css_file = File.join(self.class.public, self.class.css_dir, "#{path}.css")
|
21
|
+
sass_file = File.join(self.class.views, self.class.css_dir, "#{path}.css.sass")
|
22
|
+
|
23
23
|
if File.exists?(css_file) || File.exists?(sass_file)
|
24
24
|
stylesheet_link_tag "#{path}.css"
|
25
25
|
end
|
data/middleman.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{middleman}
|
8
|
-
s.version = "0.10.
|
8
|
+
s.version = "0.10.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Thomas Reynolds"]
|
@@ -89,6 +89,7 @@ Gem::Specification.new do |s|
|
|
89
89
|
"spec/cache_buster_spec.rb",
|
90
90
|
"spec/fixtures/sample/init.rb",
|
91
91
|
"spec/generator_spec.rb",
|
92
|
+
"spec/helpers_spec.rb",
|
92
93
|
"spec/minify_javascript_spec.rb",
|
93
94
|
"spec/relative_assets_spec.rb",
|
94
95
|
"spec/spec_helper.rb"
|
@@ -1,4 +1,29 @@
|
|
1
1
|
# enable :maruku
|
2
2
|
get "/inline-js.html" do
|
3
3
|
haml :"inline-js.html", :layout => false
|
4
|
+
end
|
5
|
+
|
6
|
+
|
7
|
+
get "/page-class.html" do
|
8
|
+
haml :"page-classes.html", :layout => false
|
9
|
+
end
|
10
|
+
|
11
|
+
get "/sub1/page-class.html" do
|
12
|
+
haml :"page-classes.html", :layout => false
|
13
|
+
end
|
14
|
+
|
15
|
+
get "/sub1/sub2/page-class.html" do
|
16
|
+
haml :"page-classes.html", :layout => false
|
17
|
+
end
|
18
|
+
|
19
|
+
get "/auto-css.html" do
|
20
|
+
haml :"auto-css.html", :layout => false
|
21
|
+
end
|
22
|
+
|
23
|
+
get "/sub1/auto-css.html" do
|
24
|
+
haml :"auto-css.html", :layout => false
|
25
|
+
end
|
26
|
+
|
27
|
+
get "/sub1/sub2/auto-css.html" do
|
28
|
+
haml :"auto-css.html", :layout => false
|
4
29
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rack/test'
|
2
|
+
require File.join(File.dirname(__FILE__), "spec_helper")
|
3
|
+
|
4
|
+
base = ::Middleman::Base
|
5
|
+
base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample")
|
6
|
+
|
7
|
+
describe "page_classes helper" do
|
8
|
+
it "should generate root paths correctly" do
|
9
|
+
browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
|
10
|
+
browser.get("/page-class.html")
|
11
|
+
browser.last_response.body.chomp.should == "page-class"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate 1-deep paths correctly" do
|
15
|
+
browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
|
16
|
+
browser.get("/sub1/page-class.html")
|
17
|
+
browser.last_response.body.chomp.should == "sub1 sub1_page-class"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should generate 2-deep paths correctly" do
|
21
|
+
browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
|
22
|
+
browser.get("/sub1/sub2/page-class.html")
|
23
|
+
browser.last_response.body.chomp.should == "sub1 sub1_sub2 sub1_sub2_page-class"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "auto_stylesheet_link_tag helper" do
|
28
|
+
it "should generate root paths correctly" do
|
29
|
+
browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
|
30
|
+
browser.get("/auto-css.html")
|
31
|
+
browser.last_response.body.chomp.should include("stylesheets/auto-css.css")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should generate 1-deep paths correctly" do
|
35
|
+
browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
|
36
|
+
browser.get("/sub1/auto-css.html")
|
37
|
+
browser.last_response.body.chomp.should include("stylesheets/sub1/auto-css.css")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should generate 2-deep paths correctly" do
|
41
|
+
browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
|
42
|
+
browser.get("/sub1/sub2/auto-css.html")
|
43
|
+
browser.last_response.body.chomp.should include("stylesheets/sub1/sub2/auto-css.css")
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
@@ -237,6 +237,7 @@ test_files:
|
|
237
237
|
- spec/cache_buster_spec.rb
|
238
238
|
- spec/fixtures/sample/init.rb
|
239
239
|
- spec/generator_spec.rb
|
240
|
+
- spec/helpers_spec.rb
|
240
241
|
- spec/minify_javascript_spec.rb
|
241
242
|
- spec/relative_assets_spec.rb
|
242
243
|
- spec/spec_helper.rb
|