mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
actually make ruby encoding setting work, fix gzip to read/write binary
This commit is contained in:
parent
58be0f7af9
commit
c53c46729a
4 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
Master
|
Master
|
||||||
===
|
===
|
||||||
* Bundled Normalize.css updated to 2.0.1
|
* Bundled Normalize.css updated to 2.0.1
|
||||||
|
* Fixed encoding extension activation
|
||||||
|
|
||||||
3.0.5
|
3.0.5
|
||||||
====
|
====
|
||||||
|
|
|
@ -142,7 +142,7 @@ module Middleman
|
||||||
include Middleman::CoreExtensions::RubyEncoding
|
include Middleman::CoreExtensions::RubyEncoding
|
||||||
|
|
||||||
# Basic Rack Request Handling
|
# Basic Rack Request Handling
|
||||||
include Middleman::CoreExtensions::Request
|
register Middleman::CoreExtensions::Request
|
||||||
|
|
||||||
# Handle exceptions
|
# Handle exceptions
|
||||||
register Middleman::CoreExtensions::ShowExceptions
|
register Middleman::CoreExtensions::ShowExceptions
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Middleman::CoreExtensions::RubyEncoding
|
||||||
app.send :include, InstanceMethods
|
app.send :include, InstanceMethods
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias :included :registered
|
||||||
end
|
end
|
||||||
|
|
||||||
module InstanceMethods
|
module InstanceMethods
|
||||||
|
|
|
@ -40,7 +40,7 @@ module Middleman::Extensions
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.gzip_file(path)
|
def self.gzip_file(path)
|
||||||
input_file = File.open(path, 'r').read
|
input_file = File.open(path, 'rb').read
|
||||||
output_filename = path + '.gz'
|
output_filename = path + '.gz'
|
||||||
input_file_time = File.mtime(path)
|
input_file_time = File.mtime(path)
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ module Middleman::Extensions
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(output_filename, 'w') do |f|
|
File.open(output_filename, 'wb') do |f|
|
||||||
gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)
|
gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)
|
||||||
gz.mtime = input_file_time.to_i
|
gz.mtime = input_file_time.to_i
|
||||||
gz.write input_file
|
gz.write input_file
|
||||||
|
|
Loading…
Reference in a new issue