middleman 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.1
1
+ 0.11.2
@@ -1,6 +1,4 @@
1
- class Middleman::Base
2
- include Middleman::Sass
3
-
1
+ class Middleman::Base
4
2
  after_feature_init do
5
3
  ::Compass.configuration do |config|
6
4
  config.asset_cache_buster do |path, real_path|
@@ -31,8 +29,12 @@ class << Middleman::Base
31
29
  rescue
32
30
  end
33
31
 
34
- real_path = File.join(self.public, prefix, path)
35
- http_path << "?" + File.mtime(real_path).strftime("%s") if File.readable?(real_path)
32
+ real_path_static = File.join(self.public, prefix, path)
33
+ real_path_dynamic = File.join(self.views, prefix, path)
34
+ real_path_dynamic << ".sass" if File.extname(real_path_dynamic) == ".css"
35
+
36
+ http_path << "?" + File.mtime(real_path_static).strftime("%s") if File.readable?(real_path_static)
37
+ http_path << "?" + File.mtime(real_path_dynamic).strftime("%s") if File.readable?(real_path_dynamic)
36
38
  http_path
37
39
  end
38
40
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{middleman}
8
- s.version = "0.11.1"
8
+ s.version = "0.11.2"
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"]
@@ -57,7 +57,8 @@ Gem::Specification.new do |s|
57
57
  "middleman.gemspec",
58
58
  "spec/auto_image_sizes.rb",
59
59
  "spec/builder_spec.rb",
60
- "spec/cache_buster_spec.rb",
60
+ "spec/cache_buster_off_spec.rb",
61
+ "spec/cache_buster_on_spec.rb",
61
62
  "spec/fixtures/sample/init.rb",
62
63
  "spec/fixtures/sample/public/images/blank.gif",
63
64
  "spec/fixtures/sample/public/javascripts/to-be-included.js",
@@ -69,6 +70,7 @@ Gem::Specification.new do |s|
69
70
  "spec/fixtures/sample/views/_partial.haml",
70
71
  "spec/fixtures/sample/views/auto-css.html.haml",
71
72
  "spec/fixtures/sample/views/auto-image-sizes.html.haml",
73
+ "spec/fixtures/sample/views/cache-buster.html.haml",
72
74
  "spec/fixtures/sample/views/custom-layout.html.haml",
73
75
  "spec/fixtures/sample/views/custom.haml",
74
76
  "spec/fixtures/sample/views/index.html.haml",
@@ -98,7 +100,8 @@ Gem::Specification.new do |s|
98
100
  s.test_files = [
99
101
  "spec/auto_image_sizes.rb",
100
102
  "spec/builder_spec.rb",
101
- "spec/cache_buster_spec.rb",
103
+ "spec/cache_buster_off_spec.rb",
104
+ "spec/cache_buster_on_spec.rb",
102
105
  "spec/fixtures/sample/init.rb",
103
106
  "spec/generator_spec.rb",
104
107
  "spec/helpers_spec.rb",
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), "spec_helper")
2
+
3
+ describe "Cache Buster Feature in CSS" do
4
+ before :each do
5
+ @base = ::Middleman::Base
6
+ @base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample")
7
+ @base.disable :cache_buster
8
+ end
9
+
10
+ it "should not append query string in CSS if off" do
11
+ browser = Rack::Test::Session.new(Rack::MockSession.new(@base.new))
12
+ browser.get("/stylesheets/relative_assets.css")
13
+ browser.last_response.body.should_not include("?")
14
+ end
15
+
16
+ it "should not append query string in HTML if off" do
17
+ browser = Rack::Test::Session.new(Rack::MockSession.new(@base.new))
18
+ browser.get("/cache-buster.html")
19
+ browser.last_response.body.count("?").should == 0
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), "spec_helper")
2
+
3
+ describe "Cache Buster Feature in CSS" do
4
+ before :each do
5
+ @base = ::Middleman::Base
6
+ @base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample")
7
+ @base.enable :cache_buster
8
+ end
9
+
10
+ it "should append query string in CSS if on" do
11
+ browser = Rack::Test::Session.new(Rack::MockSession.new(@base.new))
12
+ browser.get("/stylesheets/relative_assets.css")
13
+ browser.last_response.body.should include("?")
14
+ end
15
+
16
+ it "should append query string in HTML if on" do
17
+ browser = Rack::Test::Session.new(Rack::MockSession.new(@base.new))
18
+ browser.get("/cache-buster.html")
19
+ browser.last_response.body.count("?").should == 2
20
+ end
21
+ end
@@ -0,0 +1,2 @@
1
+ = stylesheet_link_tag "site.css"
2
+ = javascript_include_tag "empty-with-include.js"
@@ -1,6 +1,5 @@
1
1
  %html
2
2
  %head
3
- %link{ :href => "/stylesheets/site.css", :rel => "stylesheet", :type => "text/css" }
4
3
  %title My Sample Site
5
4
  %body
6
5
  = yield
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.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -204,7 +204,8 @@ files:
204
204
  - middleman.gemspec
205
205
  - spec/auto_image_sizes.rb
206
206
  - spec/builder_spec.rb
207
- - spec/cache_buster_spec.rb
207
+ - spec/cache_buster_off_spec.rb
208
+ - spec/cache_buster_on_spec.rb
208
209
  - spec/fixtures/sample/init.rb
209
210
  - spec/fixtures/sample/public/images/blank.gif
210
211
  - spec/fixtures/sample/public/javascripts/to-be-included.js
@@ -216,6 +217,7 @@ files:
216
217
  - spec/fixtures/sample/views/_partial.haml
217
218
  - spec/fixtures/sample/views/auto-css.html.haml
218
219
  - spec/fixtures/sample/views/auto-image-sizes.html.haml
220
+ - spec/fixtures/sample/views/cache-buster.html.haml
219
221
  - spec/fixtures/sample/views/custom-layout.html.haml
220
222
  - spec/fixtures/sample/views/custom.haml
221
223
  - spec/fixtures/sample/views/index.html.haml
@@ -266,7 +268,8 @@ summary: A static site generator utilizing Haml, Sass and providing YUI compress
266
268
  test_files:
267
269
  - spec/auto_image_sizes.rb
268
270
  - spec/builder_spec.rb
269
- - spec/cache_buster_spec.rb
271
+ - spec/cache_buster_off_spec.rb
272
+ - spec/cache_buster_on_spec.rb
270
273
  - spec/fixtures/sample/init.rb
271
274
  - spec/generator_spec.rb
272
275
  - spec/helpers_spec.rb
@@ -1,20 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "spec_helper")
2
-
3
- base = ::Middleman::Base
4
- base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample")
5
-
6
- describe "Cache Buster Feature" do
7
- it "should not append query string if off" do
8
- base.disable :cache_buster
9
- browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
10
- browser.get("/stylesheets/relative_assets.css")
11
- browser.last_response.body.should_not include("?")
12
- end
13
-
14
- it "should append query string if on" do
15
- base.enable :cache_buster
16
- browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
17
- browser.get("/stylesheets/relative_assets.css")
18
- browser.last_response.body.should include("?")
19
- end
20
- end