make sure logging works, more file watcher ignores

This commit is contained in:
Thomas Reynolds 2012-01-16 15:02:38 -08:00
parent d1f0e6f616
commit 2c42cb4930
3 changed files with 9 additions and 4 deletions

View file

@ -321,8 +321,6 @@ class Middleman::Base
@req = Rack::Request.new(env) @req = Rack::Request.new(env)
@res = Rack::Response.new @res = Rack::Response.new
puts "== Request: #{env["PATH_INFO"]}" if logging?
if env["PATH_INFO"] == "/__middleman__" && env["REQUEST_METHOD"] == "POST" if env["PATH_INFO"] == "/__middleman__" && env["REQUEST_METHOD"] == "POST"
if req.params.has_key?("change") if req.params.has_key?("change")
self.files.did_change(req.params["change"]) self.files.did_change(req.params["change"])
@ -333,6 +331,8 @@ class Middleman::Base
res.status = 200 res.status = 200
return res.finish return res.finish
end end
puts "== Request: #{env["PATH_INFO"]}" if logging?
# Catch :halt exceptions and use that response if given # Catch :halt exceptions and use that response if given
catch(:halt) do catch(:halt) do

View file

@ -81,6 +81,7 @@ module Middleman::CoreExtensions::FileWatcher
# @param [String] path The file that changed # @param [String] path The file that changed
# @return [void] # @return [void]
def did_change(path) def did_change(path)
puts "== File Change: #{path}" if instance.logging? && !::Middleman::Watcher.ignore_list.any? { |r| path.match(r) }
self.known_paths << path unless self.known_paths.include?(path) self.known_paths << path unless self.known_paths.include?(path)
self.run_callbacks(path, :changed) self.run_callbacks(path, :changed)
end end
@ -90,6 +91,7 @@ module Middleman::CoreExtensions::FileWatcher
# @param [String] path The file that was deleted # @param [String] path The file that was deleted
# @return [void] # @return [void]
def did_delete(path) def did_delete(path)
puts "== File Deletion: #{path}" if instance.logging? && !::Middleman::Watcher.ignore_list.any? { |r| path.match(r) }
self.known_paths.delete(path) if self.known_paths.include?(path) self.known_paths.delete(path) if self.known_paths.include?(path)
self.run_callbacks(path, :deleted) self.run_callbacks(path, :deleted)
end end

View file

@ -23,7 +23,10 @@ module Middleman
[ [
/\.sass-cache/, /\.sass-cache/,
/\.git/, /\.git/,
/\.DS_Store/ /\.DS_Store/,
/build/,
/\.rbenv-version/,
/Gemfile/
] ]
end end
end end
@ -76,7 +79,7 @@ module Middleman
set :environment, env set :environment, env
set :logging, is_logging set :logging, is_logging
end end
$stderr.puts "Is logging?: #{is_logging}"
app_rack = app.class.to_rack_app app_rack = app.class.to_rack_app
opts = @options.dup opts = @options.dup