From c53c46729abaa37e36e885a35e392ce2f817bda2 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Sat, 29 Sep 2012 14:12:26 -0700 Subject: [PATCH] actually make ruby encoding setting work, fix gzip to read/write binary --- CHANGELOG.md | 1 + middleman-core/lib/middleman-core/application.rb | 2 +- .../lib/middleman-core/core_extensions/ruby_encoding.rb | 1 + middleman-more/lib/middleman-more/extensions/gzip.rb | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8e0bb0f..09b996cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Master === * Bundled Normalize.css updated to 2.0.1 +* Fixed encoding extension activation 3.0.5 ==== diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index a3772cd3..be560400 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -142,7 +142,7 @@ module Middleman include Middleman::CoreExtensions::RubyEncoding # Basic Rack Request Handling - include Middleman::CoreExtensions::Request + register Middleman::CoreExtensions::Request # Handle exceptions register Middleman::CoreExtensions::ShowExceptions diff --git a/middleman-core/lib/middleman-core/core_extensions/ruby_encoding.rb b/middleman-core/lib/middleman-core/core_extensions/ruby_encoding.rb index b34f4219..e9168386 100644 --- a/middleman-core/lib/middleman-core/core_extensions/ruby_encoding.rb +++ b/middleman-core/lib/middleman-core/core_extensions/ruby_encoding.rb @@ -9,6 +9,7 @@ module Middleman::CoreExtensions::RubyEncoding app.send :include, InstanceMethods end + alias :included :registered end module InstanceMethods diff --git a/middleman-more/lib/middleman-more/extensions/gzip.rb b/middleman-more/lib/middleman-more/extensions/gzip.rb index a30139e5..4cb1ae6d 100644 --- a/middleman-more/lib/middleman-more/extensions/gzip.rb +++ b/middleman-more/lib/middleman-more/extensions/gzip.rb @@ -40,7 +40,7 @@ module Middleman::Extensions end def self.gzip_file(path) - input_file = File.open(path, 'r').read + input_file = File.open(path, 'rb').read output_filename = path + '.gz' input_file_time = File.mtime(path) @@ -49,7 +49,7 @@ module Middleman::Extensions return end - File.open(output_filename, 'w') do |f| + File.open(output_filename, 'wb') do |f| gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION) gz.mtime = input_file_time.to_i gz.write input_file