diff --git a/lib/middleman/templater+dynamic_renderer.rb b/lib/middleman/templater+dynamic_renderer.rb new file mode 100644 index 00000000..70f018af --- /dev/null +++ b/lib/middleman/templater+dynamic_renderer.rb @@ -0,0 +1,30 @@ +# Monkey-patch to use a dynamic renderer +class Templater::Actions::File + def identical? + if exists? + return true if File.mtime(source) < File.mtime(destination) + FileUtils.identical?(source, destination) + else + false + end + end +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 + end + + def identical? + if File.exists?(destination) + return true if File.exists?(source) && File.mtime(source) < File.mtime(destination) + File.read(destination) == render + else + false + end + end +end \ No newline at end of file diff --git a/middleman.gemspec b/middleman.gemspec index 6b39f1f9..0f181b7f 100644 --- a/middleman.gemspec +++ b/middleman.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{middleman} - s.version = "0.9.9" + s.version = "0.9.10" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Thomas Reynolds"] @@ -69,12 +69,11 @@ Gem::Specification.new do |s| "spec/relative_assets_spec.rb", "spec/spec_helper.rb" ] - s.has_rdoc = true s.homepage = %q{http://wiki.github.com/tdreyno/middleman} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubyforge_project = %q{middleman} - s.rubygems_version = %q{1.3.1} + s.rubygems_version = %q{1.3.5} s.summary = %q{A static site generator utilizing Haml, Sass and providing YUI compression and cache busting} s.test_files = [ "spec/builder_spec.rb", @@ -87,7 +86,7 @@ Gem::Specification.new do |s| if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION - s.specification_version = 2 + s.specification_version = 3 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [">= 0"])