middleman 0.11.2 → 0.11.3
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/builder.rb +5 -1
- data/lib/middleman/features/cache_buster.rb +8 -5
- data/lib/middleman/features/minify_javascript.rb +0 -18
- data/lib/middleman/rack/sprockets.rb +15 -1
- data/middleman.gemspec +1 -3
- data/spec/cache_buster_on_spec.rb +2 -2
- metadata +1 -3
- data/deps.rip +0 -7
- data/lib/middleman/features/sprockets.rb +0 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.
|
1
|
+
0.11.3
|
data/lib/middleman/builder.rb
CHANGED
@@ -27,6 +27,9 @@ module Middleman
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.file(name, *args, &block)
|
30
|
+
file_ext = File.extname(args[0])
|
31
|
+
return if Middleman::Base.supported_formats.include? file_ext[1..file_ext.length]
|
32
|
+
|
30
33
|
if (args[0] === args[1])
|
31
34
|
args[1] = args[0].gsub("#{File.basename(Middleman::Base.views)}/", "").gsub("#{File.basename(Middleman::Base.public)}/", "")
|
32
35
|
end
|
@@ -35,7 +38,8 @@ module Middleman
|
|
35
38
|
|
36
39
|
def self.init!
|
37
40
|
glob! File.basename(Middleman::Base.public), []
|
38
|
-
glob! File.basename(Middleman::Base.views),
|
41
|
+
glob! File.basename(Middleman::Base.views), %w(sass js)
|
42
|
+
glob! File.basename(Middleman::Base.views), Middleman::Base.supported_formats - %w(sass js)
|
39
43
|
end
|
40
44
|
|
41
45
|
def after_run
|
@@ -30,11 +30,14 @@ class << Middleman::Base
|
|
30
30
|
end
|
31
31
|
|
32
32
|
real_path_static = File.join(self.public, prefix, path)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
|
34
|
+
if File.readable?(real_path_static)
|
35
|
+
http_path << "?" + File.mtime(real_path_static).strftime("%s")
|
36
|
+
elsif Middleman::Base.environment == "build"
|
37
|
+
real_path_dynamic = File.join(self.root, self.build_dir, prefix, path)
|
38
|
+
http_path << "?" + File.mtime(real_path_dynamic).strftime("%s") if File.readable?(real_path_dynamic)
|
39
|
+
end
|
40
|
+
|
38
41
|
http_path
|
39
42
|
end
|
40
43
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require "yui/compressor"
|
2
1
|
require "middleman/builder"
|
3
2
|
|
4
3
|
module Middleman
|
@@ -14,23 +13,6 @@ END
|
|
14
13
|
end
|
15
14
|
end
|
16
15
|
end
|
17
|
-
|
18
|
-
class Builder
|
19
|
-
alias_method :pre_yui_after_run, :after_run
|
20
|
-
def after_run
|
21
|
-
pre_yui_after_run
|
22
|
-
|
23
|
-
compressor = ::YUI::JavaScriptCompressor.new(:munge => true)
|
24
|
-
Dir[File.join(Middleman::Base.build_dir, Middleman::Base.js_dir, "**", "*.js")].each do |path|
|
25
|
-
lines = IO.readlines(path)
|
26
|
-
if lines.length > 1
|
27
|
-
compressed_js = compressor.compress(lines.join($/))
|
28
|
-
File.open(path, 'w') { |f| f.write(compressed_js) }
|
29
|
-
say "<%= color('#{"[COMPRESSED]".rjust(12)}', :yellow) %> " + path.gsub(Middleman::Base.build_dir+"/", '')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
16
|
end
|
35
17
|
|
36
18
|
Middleman::Base.supported_formats << "js"
|
@@ -1,9 +1,16 @@
|
|
1
1
|
begin
|
2
2
|
require 'sprockets'
|
3
3
|
require 'middleman/rack/sprockets+ruby19' # Sprockets ruby 1.9 duckpunch
|
4
|
+
|
4
5
|
rescue LoadError
|
5
6
|
puts "Sprockets not available. Install it with: gem install sprockets"
|
6
7
|
end
|
8
|
+
|
9
|
+
begin
|
10
|
+
require "yui/compressor"
|
11
|
+
rescue LoadError
|
12
|
+
puts "Sprockets not available. Install it with: gem install yui-compressor"
|
13
|
+
end
|
7
14
|
|
8
15
|
module Middleman
|
9
16
|
module Rack
|
@@ -21,8 +28,15 @@ module Middleman
|
|
21
28
|
:source_files => [ File.join("views", path) ],
|
22
29
|
:load_path => [ File.join("public", Middleman::Base.js_dir),
|
23
30
|
File.join("views", Middleman::Base.js_dir) ])
|
31
|
+
|
32
|
+
result = secretary.concatenation.to_s
|
33
|
+
|
34
|
+
if @app.class.respond_to?(:minify_javascript?) && @app.class.minify_javascript?
|
35
|
+
compressor = ::YUI::JavaScriptCompressor.new(:munge => true)
|
36
|
+
result = compressor.compress(result)
|
37
|
+
end
|
24
38
|
|
25
|
-
[200, { "Content-Type" => "text/javascript" }, [
|
39
|
+
[200, { "Content-Type" => "text/javascript" }, [result]]
|
26
40
|
else
|
27
41
|
@app.call(env)
|
28
42
|
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.11.
|
8
|
+
s.version = "0.11.3"
|
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"]
|
@@ -27,7 +27,6 @@ Gem::Specification.new do |s|
|
|
27
27
|
"bin/mm-build",
|
28
28
|
"bin/mm-init",
|
29
29
|
"bin/mm-server",
|
30
|
-
"deps.rip",
|
31
30
|
"lib/middleman.rb",
|
32
31
|
"lib/middleman/base.rb",
|
33
32
|
"lib/middleman/builder.rb",
|
@@ -42,7 +41,6 @@ Gem::Specification.new do |s|
|
|
42
41
|
"lib/middleman/features/relative_assets.rb",
|
43
42
|
"lib/middleman/features/slickmap.rb",
|
44
43
|
"lib/middleman/features/smush_pngs.rb",
|
45
|
-
"lib/middleman/features/sprockets.rb",
|
46
44
|
"lib/middleman/haml.rb",
|
47
45
|
"lib/middleman/helpers.rb",
|
48
46
|
"lib/middleman/rack/sprockets+ruby19.rb",
|
@@ -13,9 +13,9 @@ describe "Cache Buster Feature in CSS" do
|
|
13
13
|
browser.last_response.body.should include("?")
|
14
14
|
end
|
15
15
|
|
16
|
-
it "should append query string in HTML if on" do
|
16
|
+
it "should not append query string in HTML if on IN DEVELOPMENT" do
|
17
17
|
browser = Rack::Test::Session.new(Rack::MockSession.new(@base.new))
|
18
18
|
browser.get("/cache-buster.html")
|
19
|
-
browser.last_response.body.count("?").should ==
|
19
|
+
browser.last_response.body.count("?").should == 0
|
20
20
|
end
|
21
21
|
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.11.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
@@ -174,7 +174,6 @@ files:
|
|
174
174
|
- bin/mm-build
|
175
175
|
- bin/mm-init
|
176
176
|
- bin/mm-server
|
177
|
-
- deps.rip
|
178
177
|
- lib/middleman.rb
|
179
178
|
- lib/middleman/base.rb
|
180
179
|
- lib/middleman/builder.rb
|
@@ -189,7 +188,6 @@ files:
|
|
189
188
|
- lib/middleman/features/relative_assets.rb
|
190
189
|
- lib/middleman/features/slickmap.rb
|
191
190
|
- lib/middleman/features/smush_pngs.rb
|
192
|
-
- lib/middleman/features/sprockets.rb
|
193
191
|
- lib/middleman/haml.rb
|
194
192
|
- lib/middleman/helpers.rb
|
195
193
|
- lib/middleman/rack/sprockets+ruby19.rb
|
data/deps.rip
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
git://github.com/jnicklas/templater.git
|
2
|
-
git://github.com/sstephenson/sprockets.git
|
3
|
-
git://github.com/sinatra/sinatra.git
|
4
|
-
git://github.com/nex3/haml.git
|
5
|
-
git://github.com/chriseppstein/compass.git
|
6
|
-
git://github.com/foca/sinatra-content-for.git
|
7
|
-
git://github.com/brynary/rack-test.git
|