Fix a bunch of Ruby warnings, including a bug in the not_found method
This commit is contained in:
parent
1d869b0c08
commit
397ccd2c1e
6 changed files with 10 additions and 10 deletions
|
@ -39,8 +39,8 @@ module Middleman
|
|||
klass.start(["-h", task].compact, :shell => self.shell)
|
||||
else
|
||||
list = []
|
||||
Thor::Util.thor_classes_in(Middleman::Cli).each do |klass|
|
||||
list += klass.printable_tasks(false)
|
||||
Thor::Util.thor_classes_in(Middleman::Cli).each do |thor_class|
|
||||
list += thor_class.printable_tasks(false)
|
||||
end
|
||||
list.sort!{ |a,b| a[0] <=> b[0] }
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ module Middleman::CoreExtensions
|
|||
elsif result = parse_json_front_matter(content)
|
||||
data, content = result
|
||||
end
|
||||
rescue => e
|
||||
rescue
|
||||
# Probably a binary file, move on
|
||||
end
|
||||
end
|
||||
|
|
|
@ -150,7 +150,7 @@ module Middleman
|
|||
opts[:template_body] = content if content
|
||||
content = render_individual_file(path, locs, opts, context)
|
||||
path = File.basename(path, File.extname(path))
|
||||
rescue LocalJumpError => e
|
||||
rescue LocalJumpError
|
||||
raise "Tried to render a layout (calls yield) at #{path} like it was a template. Non-default layouts need to be in #{source}/layouts."
|
||||
end
|
||||
end
|
||||
|
@ -298,9 +298,9 @@ module Middleman
|
|||
# Find all the engines which handle this extension in tilt. Look for
|
||||
# config variables of that name and merge it
|
||||
extension_class = ::Tilt[ext]
|
||||
::Tilt.mappings.each do |ext, engines|
|
||||
::Tilt.mappings.each do |mapping_ext, engines|
|
||||
next unless engines.include? extension_class
|
||||
engine_options = config[ext.to_sym] || {}
|
||||
engine_options = config[mapping_ext.to_sym] || {}
|
||||
options.merge!(engine_options)
|
||||
end
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ module Middleman
|
|||
|
||||
# Halt request and return 404
|
||||
def not_found(res, path)
|
||||
res.status == 404
|
||||
res.status = 404
|
||||
res.write "<html><body><h1>File Not Found</h1><p>#{path}</p></body>"
|
||||
res.finish
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ module Middleman
|
|||
if url.is_a?(Regexp) || url.include?("*")
|
||||
|
||||
# Use the metadata loop for matching against paths at runtime
|
||||
sitemap.provides_metadata_for_path url do |url|
|
||||
sitemap.provides_metadata_for_path(url) do |_|
|
||||
{ :options => opts, :blocks => blocks }
|
||||
end
|
||||
|
||||
|
@ -77,7 +77,7 @@ module Middleman
|
|||
end
|
||||
|
||||
# Setup a metadata matcher for rendering those options
|
||||
sitemap.provides_metadata_for_path url do |url|
|
||||
sitemap.provides_metadata_for_path(url) do |_|
|
||||
{ :options => opts, :blocks => blocks }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -149,7 +149,7 @@ module Middleman
|
|||
|
||||
begin
|
||||
::WEBrick::HTTPServer.new(http_opts)
|
||||
rescue Errno::EADDRINUSE => e
|
||||
rescue Errno::EADDRINUSE
|
||||
logger.error "== Port #{port} is unavailable. Either close the instance of Middleman already running on #{port} or start this Middleman on a new port with: --port=#{port.to_i+1}"
|
||||
exit(1)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue