Merge branch '3.0-stable'

This commit is contained in:
Ben Hollis 2013-03-10 16:32:55 -07:00
commit 6672c1c324
4 changed files with 35 additions and 2 deletions

View file

@ -0,0 +1,13 @@
Feature: Unicode filecontents
In order to support non-ASCII characters in file contents
Scenario: Rebuild with files containing unicode characters in their name
Given a fixture app "clean-app"
And a file named "source/index.html.erb" with:
"""
"""
And a successfully built app at "clean-app"
And a modification time for a file named "build/index.html"
And a successfully built app at "clean-app"
Then the file "build/index.html" should not have been updated

View file

@ -137,7 +137,7 @@ module Middleman::Cli
response = self.class.shared_rack.get(URI.escape(resource.destination_path)) response = self.class.shared_rack.get(URI.escape(resource.destination_path))
if response.status == 200 if response.status == 200
create_file(output_file, response.body) create_file(output_file, binary_encode(response.body))
else else
handle_error(output_file, response.body) handle_error(output_file, response.body)
end end
@ -160,6 +160,13 @@ module Middleman::Cli
self.shell.error(response) self.shell.error(response)
end end
end end
def binary_encode(string)
if string.respond_to?(:force_encoding)
string.force_encoding("ascii-8bit")
end
string
end
} }
end end

View file

@ -1,6 +1,5 @@
# Use the Ruby/Rails logger # Use the Ruby/Rails logger
require 'active_support/core_ext/logger' require 'active_support/core_ext/logger'
require "securerandom"
module Middleman module Middleman

View file

@ -1,5 +1,9 @@
require 'fileutils' require 'fileutils'
Before do
@modification_times = Hash.new
end
Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name| Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name|
target = File.join(PROJECT_ROOT_PATH, "fixtures", path) target = File.join(PROJECT_ROOT_PATH, "fixtures", path)
config_path = File.join(current_dir, "config-#{config_name}.rb") config_path = File.join(current_dir, "config-#{config_name}.rb")
@ -53,6 +57,16 @@ Given /^a successfully built app at "([^\"]*)" with flags "([^\"]*)"$/ do |path,
step %Q{was successfully built} step %Q{was successfully built}
end end
Given /^a modification time for a file named "([^\"]*)"$/ do |file|
target = File.join(current_dir, file)
@modification_times[target] = File.mtime(target)
end
Then /^the file "([^\"]*)" should not have been updated$/ do |file|
target = File.join(current_dir, file)
File.mtime(target).should == @modification_times[target]
end
# Provide this Aruba overload in case we're matching something with quotes in it # Provide this Aruba overload in case we're matching something with quotes in it
Then /^the file "([^"]*)" should contain '([^']*)'$/ do |file, partial_content| Then /^the file "([^"]*)" should contain '([^']*)'$/ do |file, partial_content|
check_file_content(file, partial_content, true) check_file_content(file, partial_content, true)