From 9887fe510ce46662356c76c18880d2f9653850ee Mon Sep 17 00:00:00 2001 From: adamjonas Date: Thu, 15 May 2014 11:51:42 -0400 Subject: [PATCH 1/6] update rspec should syntax to expect --- middleman-core/spec/middleman-core/binary_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middleman-core/spec/middleman-core/binary_spec.rb b/middleman-core/spec/middleman-core/binary_spec.rb index 1643bd93..79944331 100644 --- a/middleman-core/spec/middleman-core/binary_spec.rb +++ b/middleman-core/spec/middleman-core/binary_spec.rb @@ -3,13 +3,13 @@ require 'middleman-core/util' describe "Middleman::Util#binary?" do %w(plain.txt unicode.txt unicode).each do |file| it "recognizes #{file} as not binary" do - Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}")).should be_false + expect(Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}"))).to be_false end end %w(middleman.png middleman stars.svgz).each do |file| it "recognizes #{file} as binary" do - Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}")).should be_true + expect(Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}"))).to be_true end end end From dc33f6b3fade71b26bbc3c7b1cb56f2d3abb45a1 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Thu, 15 May 2014 23:55:39 -0700 Subject: [PATCH 2/6] Fix before_render after change to hooks-0.4.0. Related to #1278. --- .../lib/middleman-core/core_extensions/rendering.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index 98c0b600..2b5347a9 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -251,7 +251,12 @@ module Middleman template_class = Tilt[path] # Allow hooks to manipulate the template before render self.class.callbacks_for_hook(:before_render).each do |callback| - newbody = callback.call(body, path, locs, template_class) + # Uber::Options::Value doesn't respond to call + newbody = if callback.respond_to?(:call) + callback.call(body, path, locs, template_class) + elsif callback.respond_to?(:evaluate) + callback.evaluate(self, body, path, locs, template_class) + end body = newbody if newbody # Allow the callback to return nil to skip it end @@ -266,11 +271,12 @@ module Middleman # Allow hooks to manipulate the result after render self.class.callbacks_for_hook(:after_render).each do |callback| # Uber::Options::Value doesn't respond to call - if callback.respond_to?(:call) + newcontent = if callback.respond_to?(:call) content = callback.call(content, path, locs, template_class) elsif callback.respond_to?(:evaluate) content = callback.evaluate(self, content, path, locs, template_class) end + content = newcontent if newcontent # Allow the callback to return nil to skip it end output = ::ActiveSupport::SafeBuffer.new '' From 610716ee805c642879679991138fd73fb756ecc7 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Thu, 22 May 2014 19:20:43 +0900 Subject: [PATCH 3/6] Work around possible mutable data issue #501 --- .../lib/middleman-core/core_extensions/rendering.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index 2b5347a9..a6b21fdd 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -222,6 +222,10 @@ module Middleman def render_individual_file(path, locs={}, opts={}, context=self, &block) path = path.to_s + # Mutability is FUN! + # Try to work around: https://github.com/middleman/middleman/issues/501 + locs = locs.dup + # Detect the remdering engine from the extension extension = File.extname(path) engine = extension[1..-1].to_sym From dc150063404705349bb387cfb1c84a7ab147dd60 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sat, 24 May 2014 18:51:18 +0900 Subject: [PATCH 4/6] We are semver --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index a90e252f..4bb81bad 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,22 @@ The best way to get quick responses to your issues and swift fixes to your bugs [Click here to lend your support to Middleman](https://spacebox.io/s/4dXbHBorC3) +## Versioning + +This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations +of this scheme should be reported as bugs. Specifically, if a minor or patch +version is released that breaks backward compatibility, that version should be +immediately yanked and/or a new version should be immediately released that +restores compatibility. Breaking changes to the public API will only be +introduced with new major versions. As a result of this policy, you can (and +should) specify a dependency on this gem using the [Pessimistic Version +Constraint][pvc] with two digits of precision. For example: + + spec.add_dependency 'middleman-core', '~> 3.0' + +[semver]: http://semver.org/ +[pvc]: http://docs.rubygems.org/read/chapter/16#page74 + ## License Copyright (c) 2010-2013 Thomas Reynolds. MIT Licensed, see [LICENSE] for details. From 72b945682a9dde08b3105135fb964ec25977df4d Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sat, 24 May 2014 19:18:12 +0900 Subject: [PATCH 5/6] Fix threadsafety issue with assignment. Fixes #501. Also, WTF? --- middleman-core/lib/middleman-core/core_extensions/rendering.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index a6b21fdd..091a0e85 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -143,7 +143,8 @@ module Middleman end # Store current locs/opts for later - @current_locs = locs, @current_opts = opts + @current_locs = locs + @current_opts = opts # Keep rendering template until we've used up all extensions. This # handles cases like `style.css.sass.erb` From 1a461154b6767be9f8de13ab12c87a4619c32495 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sat, 24 May 2014 19:27:56 +0900 Subject: [PATCH 6/6] prep --- CHANGELOG.md | 9 +++++++++ middleman-core/lib/middleman-core/version.rb | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ad318d7..f5811746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ master === +3.3.3 +=== + +* Fix thread-safety issue #501 which could cause excepts when livereloading. +* Update to support Hooks 0.4.x dep. +* Update to support Padrino 0.12.2+ dep. +* Fix `after_render` manipulation of content. #1278 +* Fix combo of compass-import-once and sass-globs. middleman/middleman-sprockets#56 + 3.3.0-3.3.2 === diff --git a/middleman-core/lib/middleman-core/version.rb b/middleman-core/lib/middleman-core/version.rb index 33ea61f6..fa5be3d0 100644 --- a/middleman-core/lib/middleman-core/version.rb +++ b/middleman-core/lib/middleman-core/version.rb @@ -1,5 +1,5 @@ module Middleman # Current Version # @return [String] - VERSION = '3.3.2' unless const_defined?(:VERSION) + VERSION = '3.3.3' unless const_defined?(:VERSION) end