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:
commit
c0c14f4eab
|
@ -19,9 +19,13 @@ Master
|
|||
====
|
||||
|
||||
* Directly send binary files in preview and copy them in build, avoiding reading large binary files into memory for rendering. #643 #699
|
||||
* Make link_to helper ignore QueryString values when looking up Sitemap resources
|
||||
* Directly copy binary files during build, and stream them during preview, to avoid reading them into memory
|
||||
* Make sure all paths in Sitemap are using Pathname
|
||||
|
||||
3.0.7
|
||||
====
|
||||
|
||||
* Turn html5 boilerplate into a layout
|
||||
* Fix errors when templates have empty YAML
|
||||
* Show the hostname when initializing MM
|
||||
|
|
20
middleman-core/features/missing-tilt-lib.feature
Normal file
20
middleman-core/features/missing-tilt-lib.feature
Normal file
|
@ -0,0 +1,20 @@
|
|||
Feature: Tilt missing support libraries
|
||||
|
||||
Scenario: Rendering Textile and Wiki files
|
||||
Given the Server is running at "missing-tilt-library-app"
|
||||
When I go to "/danger-zone/more-wiki.html.wiki"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/danger-zone/more-wiki.html"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/safe-zone/my-wiki.html.wiki"
|
||||
Then I should see "Safe"
|
||||
When I go to "/safe-zone/my-wiki.html"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/textile-source.html.textile"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/textile-source.html"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/wiki-source.html.wiki"
|
||||
Then I should see "Hola"
|
||||
When I go to "/wiki-source.html"
|
||||
Then I should see "File Not Found"
|
|
@ -0,0 +1,2 @@
|
|||
ignore "danger-zone/*"
|
||||
ignore "*.textile"
|
|
@ -0,0 +1 @@
|
|||
More
|
|
@ -0,0 +1 @@
|
|||
Safe
|
|
@ -0,0 +1 @@
|
|||
Textx
|
|
@ -0,0 +1 @@
|
|||
Hola
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,6 +21,40 @@ Feature: link_to helper
|
|||
Then I should see 'absolute: <a href="../needs_index.html">Needs Index</a>'
|
||||
Then I should see 'relative: <a href="../needs_index.html">Relative</a>'
|
||||
|
||||
Scenario: link_to relative works with strip_index_file
|
||||
Given a fixture app "indexable-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
set :relative_links, true
|
||||
set :strip_index_file, true
|
||||
helpers do
|
||||
def menu_items(path='link_to.html')
|
||||
sitemap.find_resource_by_destination_path(path).children
|
||||
end
|
||||
end
|
||||
"""
|
||||
And a file named "source/link_to.html.erb" with:
|
||||
"""
|
||||
<% menu_items.each do |item| %>
|
||||
<%= link_to(item.metadata[:page]['title'], item.url) %>
|
||||
<%= link_to(item.metadata[:page]['title'], item) %>
|
||||
<% end %>
|
||||
"""
|
||||
And a file named "source/link_to/sub.html.erb" with:
|
||||
"""
|
||||
<% menu_items.each do |item| %>
|
||||
<%= link_to(item.metadata[:page]['title'], item.url) %>
|
||||
<%= link_to(item.metadata[:page]['title'], item) %>
|
||||
<% end %>
|
||||
"""
|
||||
And the Server is running at "indexable-app"
|
||||
When I go to "/link_to.html"
|
||||
Then I should see '"link_to/sub.html"'
|
||||
Then I should not see "/link_to/sub.html"
|
||||
When I go to "/link_to/sub.html"
|
||||
Then I should see '"sub.html"'
|
||||
Then I should not see "/link_to/sub.html"
|
||||
|
||||
Scenario: link_to produces relative links when :relative_links is set to true
|
||||
Given a fixture app "indexable-app"
|
||||
And a file named "config.rb" with:
|
||||
|
|
|
@ -129,15 +129,20 @@ module Middleman
|
|||
|
||||
# Handle Resources, which define their own url method
|
||||
if url.respond_to? :url
|
||||
args[url_arg_index] = url.url
|
||||
elsif url.include? '://'
|
||||
url = args[url_arg_index] = url.url
|
||||
end
|
||||
|
||||
if url.include? '://'
|
||||
raise "Can't use the relative option with an external URL" if relative
|
||||
elsif current_resource
|
||||
# Handle relative urls
|
||||
current_source_dir = Pathname('/' + current_resource.path).dirname
|
||||
|
||||
uri = URI(url)
|
||||
url_path = uri.path
|
||||
begin
|
||||
uri = URI(url)
|
||||
url_path = uri.path
|
||||
rescue
|
||||
end
|
||||
|
||||
if url_path
|
||||
path = Pathname(url_path)
|
||||
|
|
|
@ -30,7 +30,11 @@ module Middleman
|
|||
# @param [Hash] params
|
||||
# @return [String]
|
||||
def image_tag(path, params={})
|
||||
if !params.has_key?(:width) && !params.has_key?(:height) && !path.include?("://")
|
||||
params[:supported_extensions] ||= %w(.png .jpg .jpeg .bmp .gif)
|
||||
|
||||
if !params.has_key?(:width) && !params.has_key?(:height) && !path.include?("://") &&
|
||||
params[:supported_extensions].include?(File.extname(path).downcase)
|
||||
|
||||
params[:alt] ||= ""
|
||||
|
||||
real_path = path
|
||||
|
@ -50,6 +54,8 @@ module Middleman
|
|||
end
|
||||
end
|
||||
|
||||
params = params.delete_if {|key| key == :supported_extensions }
|
||||
|
||||
super(path, params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,6 +19,6 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.add_dependency("middleman-core", Middleman::VERSION)
|
||||
s.add_dependency("middleman-more", Middleman::VERSION)
|
||||
s.add_dependency("middleman-sprockets", "~> 3.0.2")
|
||||
s.add_dependency("middleman-sprockets", "~> 3.0.6")
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue