Merge remote-tracking branch 'origin/3.0-stable'

Conflicts:
	CHANGELOG.md
	middleman-core/lib/middleman-core/cli/build.rb
	middleman-core/lib/middleman-core/core_extensions/rendering.rb
	middleman-core/lib/middleman-core/preview_server.rb
	middleman-core/lib/middleman-core/renderers/sass.rb
	middleman-core/lib/middleman-core/sitemap/store.rb
	middleman-core/lib/middleman-core/util.rb
	middleman-core/lib/middleman-core/version.rb
	middleman-more/lib/middleman-more/core_extensions/compass.rb
	middleman-more/lib/middleman-more/core_extensions/default_helpers.rb
	middleman-more/lib/middleman-more/extensions/asset_hash.rb
This commit is contained in:
Ben Hollis 2013-01-25 21:43:30 -08:00
commit c0c14f4eab
15 changed files with 122 additions and 13 deletions

View file

@ -1,4 +1,5 @@
require "middleman-core"
require "fileutils"
# CLI Module
module Middleman::Cli
@ -64,7 +65,9 @@ module Middleman::Cli
action GlobAction.new(self, opts)
if @had_errors && !@debugging
self.shell.say "There were errors during this build, re-run with --verbose to see the full exception."
cmd = "middleman build --verbose"
cmd = "bundle exec '#{cmd}'" if defined?(Bundler)
self.shell.say "There were errors during this build, re-run with `#{cmd}` to see the full exception."
end
exit(1) if @had_errors
@ -118,7 +121,17 @@ module Middleman::Cli
output_file = File.join(build_dir, resource.destination_path)
if resource.binary?
copy_file(resource.source_file, output_file)
if !File.exists?(output_file)
say_status :create, output_file, :green
elsif FileUtils.compare_file(resource.source_file, output_file)
say_status :identical, output_file, :blue
return output_file
else
say_status :update, output_file, :yellow
end
FileUtils.mkdir_p(File.dirname(output_file))
FileUtils.cp(resource.source_file, output_file)
else
begin
response = self.class.shared_rack.get(URI.escape(resource.destination_path))

View file

@ -75,6 +75,19 @@ module Middleman
app.register Middleman::Renderers::Stylus
rescue LoadError
end
# Clean up missing Tilt exts
app.after_configuration do
Tilt.mappings.each do |key, klasses|
begin
Tilt[".#{key}"]
rescue LoadError
Tilt.mappings.delete(key)
rescue NameError
Tilt.mappings.delete(key)
end
end
end
end
alias :included :registered

View file

@ -16,12 +16,11 @@ module Middleman
# Location of SASS .sass-cache directory.
# @return [String]
app.config.define_setting :sass_cache_path, nil, 'Location of sass cache' # runtime compile of path
app.config.define_setting :sass_cache_path, File.join(app.root_path, '.sass-cache'), 'Location of sass cache' # runtime compile of path
app.before_configuration do
template_extensions :scss => :css,
:sass => :css
config[:sass_cache_path] = File.join(app.root_path, '.sass-cache')
end
# Tell Tilt to use it as well (for inline sass blocks)

View file

@ -10,7 +10,7 @@ require "thor"
# Core Pathname library used for traversal
require "pathname"
require 'win32/file' if File::ALT_SEPARATOR
require "rack"
module Middleman
@ -21,8 +21,17 @@ module Middleman
# @param [String] filename The file to check.
# @return [Boolean]
def self.binary?(filename)
s = (File.read(filename, File.stat(filename).blksize) || "").split(//)
((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
ext = File.extname(filename)
return false if Tilt.registered?(ext.sub('.',''))
ext = ".#{ext}" unless ext.to_s[0] == ?.
mime = ::Rack::Mime.mime_type(ext, nil)
return false unless mime
return false if mime.start_with?('text/')
return false if mime.include?('xml')
return false if mime.include?('json')
return false if mime.include?('javascript')
true
end
# The logger