From bed57058413fcb93cfefe703adfd40e86d0cdcbb Mon Sep 17 00:00:00 2001 From: tdreyno Date: Thu, 22 Oct 2009 10:14:47 -0700 Subject: [PATCH 1/3] handful of fixes --- bin/mm-server | 2 +- lib/middleman/features/cache_buster.rb | 2 +- lib/middleman/features/minify_javascript.rb | 9 ++++++--- lib/middleman/templater+dynamic_renderer.rb | 12 +++++++----- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bin/mm-server b/bin/mm-server index 86043198..d5b04e39 100755 --- a/bin/mm-server +++ b/bin/mm-server @@ -6,7 +6,7 @@ require 'optparse' require File.join(File.dirname(__FILE__), '..', 'lib', 'middleman') env = ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development' -options = { :Port => 4567, :Host => 'localhost', :AccessLog => [] } +options = { :Port => 4567, :AccessLog => [] } OptionParser.new { |opts| opts.banner = "Usage: mm-server [rack options]" diff --git a/lib/middleman/features/cache_buster.rb b/lib/middleman/features/cache_buster.rb index 323931cc..95eadcd7 100644 --- a/lib/middleman/features/cache_buster.rb +++ b/lib/middleman/features/cache_buster.rb @@ -5,7 +5,7 @@ class << Middleman::Base if http_path.include?("://") || !%w(.css .png .jpg .js .gif).include?(File.extname(http_path)) http_path else - real_path = File.join(self.environment == "build" ? self.build_dir : self.public, prefix, path) + real_path = File.join(self.public, prefix, path) http_path << "?" + File.mtime(real_path).strftime("%s") if File.readable?(real_path) http_path end diff --git a/lib/middleman/features/minify_javascript.rb b/lib/middleman/features/minify_javascript.rb index e59f24fd..b1292513 100644 --- a/lib/middleman/features/minify_javascript.rb +++ b/lib/middleman/features/minify_javascript.rb @@ -21,9 +21,12 @@ END compressor = ::YUI::JavaScriptCompressor.new(:munge => true) Dir[File.join(Middleman::Base.build_dir, Middleman::Base.js_dir, "**", "*.js")].each do |path| - compressed_js = compressor.compress(File.read(path)) - File.open(path, 'w') { |f| f.write(compressed_js) } - say "<%= color('#{"[COMPRESSED]".rjust(12)}', :yellow) %> " + path.gsub(Middleman::Base.build_dir+"/", '') + lines = IO.readlines(path) + if lines.length > 1 + compressed_js = compressor.compress(lines.join($/)) + File.open(path, 'w') { |f| f.write(compressed_js) } + say "<%= color('#{"[COMPRESSED]".rjust(12)}', :yellow) %> " + path.gsub(Middleman::Base.build_dir+"/", '') + end end end end if Middleman::Base.environment == "build" diff --git a/lib/middleman/templater+dynamic_renderer.rb b/lib/middleman/templater+dynamic_renderer.rb index 4b026e4e..4f1882a4 100644 --- a/lib/middleman/templater+dynamic_renderer.rb +++ b/lib/middleman/templater+dynamic_renderer.rb @@ -14,10 +14,12 @@ end class Templater::Actions::Template def render - # The default render just requests the page over Rack and writes the response - request_path = destination.gsub(File.join(Dir.pwd, Middleman::Base.build_dir), "") - browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Base)) - browser.get(request_path) - browser.last_response.body + @render_cache ||= begin + # The default render just requests the page over Rack and writes the response + request_path = destination.gsub(File.join(Dir.pwd, Middleman::Base.build_dir), "") + browser = Rack::Test::Session.new(Rack::MockSession.new(Middleman::Base)) + browser.get(request_path) + browser.last_response.body + end end end \ No newline at end of file From 14875f3227336f8a6ca50cd607e03a1f28485be4 Mon Sep 17 00:00:00 2001 From: tdreyno Date: Thu, 22 Oct 2009 10:16:41 -0700 Subject: [PATCH 2/3] Version bump to 0.9.18 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4148992a..7a50b681 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.17 +0.9.18 From 9b90419844fb81663b29775a40e1460e0a553282 Mon Sep 17 00:00:00 2001 From: tdreyno Date: Thu, 22 Oct 2009 10:16:43 -0700 Subject: [PATCH 3/3] Regenerated gemspec for version 0.9.18 --- middleman.gemspec | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/middleman.gemspec b/middleman.gemspec index 50e74ca9..b40f4ee5 100644 --- a/middleman.gemspec +++ b/middleman.gemspec @@ -1,15 +1,15 @@ # Generated by jeweler -# DO NOT EDIT THIS FILE -# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec` +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{middleman} - s.version = "0.9.17" + s.version = "0.9.18" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Thomas Reynolds"] - s.date = %q{2009-10-14} + s.date = %q{2009-10-22} s.email = %q{tdreyno@gmail.com} s.executables = ["mm-init", "mm-build", "mm-server"] s.extra_rdoc_files = [ @@ -30,20 +30,22 @@ Gem::Specification.new do |s| "lib/middleman.rb", "lib/middleman/base.rb", "lib/middleman/builder.rb", + "lib/middleman/config.ru", "lib/middleman/features/cache_buster.rb", "lib/middleman/features/compass.rb", - "lib/middleman/features/content_for.rb", "lib/middleman/features/growl.rb", - "lib/middleman/features/haml.rb", "lib/middleman/features/maruku.rb", "lib/middleman/features/minify_css.rb", "lib/middleman/features/minify_javascript.rb", "lib/middleman/features/relative_assets.rb", "lib/middleman/features/slickmap.rb", "lib/middleman/features/smush_pngs.rb", - "lib/middleman/features/sprockets+ruby19.rb", - "lib/middleman/features/sprockets.rb", + "lib/middleman/haml.rb", "lib/middleman/helpers.rb", + "lib/middleman/rack/sprockets+ruby19.rb", + "lib/middleman/rack/sprockets.rb", + "lib/middleman/rack/static.rb", + "lib/middleman/sass.rb", "lib/middleman/template/init.rbt", "lib/middleman/template/views/index.html.haml", "lib/middleman/template/views/layout.html.haml", @@ -53,13 +55,13 @@ Gem::Specification.new do |s| "spec/builder_spec.rb", "spec/cache_buster_spec.rb", "spec/fixtures/sample/init.rb", - "spec/fixtures/sample/public/javascripts/empty-with-include.js", "spec/fixtures/sample/public/javascripts/to-be-included.js", "spec/fixtures/sample/public/static.html", "spec/fixtures/sample/public/stylesheets/static.css", "spec/fixtures/sample/views/_partial.haml", "spec/fixtures/sample/views/index.html.haml", "spec/fixtures/sample/views/inline-js.html.haml", + "spec/fixtures/sample/views/javascripts/empty-with-include.js", "spec/fixtures/sample/views/layout.haml", "spec/fixtures/sample/views/maruku.html.maruku", "spec/fixtures/sample/views/services/index.html.haml", @@ -88,6 +90,8 @@ Gem::Specification.new do |s| s.specification_version = 3 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_runtime_dependency(%q, [">= 0"]) @@ -99,6 +103,8 @@ Gem::Specification.new do |s| s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) @@ -111,6 +117,8 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) end else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) @@ -123,3 +131,4 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0"]) end end +