From 2c42cb4930cd7c4e6bd8ef275b4ee235443e09e0 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Mon, 16 Jan 2012 15:02:38 -0800 Subject: [PATCH] make sure logging works, more file watcher ignores --- middleman-core/lib/middleman-core/base.rb | 4 ++-- .../lib/middleman-core/core_extensions/file_watcher.rb | 2 ++ middleman-core/lib/middleman-core/watcher.rb | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/middleman-core/lib/middleman-core/base.rb b/middleman-core/lib/middleman-core/base.rb index c727c967..8c9d02a4 100644 --- a/middleman-core/lib/middleman-core/base.rb +++ b/middleman-core/lib/middleman-core/base.rb @@ -321,8 +321,6 @@ class Middleman::Base @req = Rack::Request.new(env) @res = Rack::Response.new - puts "== Request: #{env["PATH_INFO"]}" if logging? - if env["PATH_INFO"] == "/__middleman__" && env["REQUEST_METHOD"] == "POST" if req.params.has_key?("change") self.files.did_change(req.params["change"]) @@ -333,6 +331,8 @@ class Middleman::Base res.status = 200 return res.finish end + + puts "== Request: #{env["PATH_INFO"]}" if logging? # Catch :halt exceptions and use that response if given catch(:halt) do diff --git a/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb b/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb index 25013524..7f6843e9 100644 --- a/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb +++ b/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb @@ -81,6 +81,7 @@ module Middleman::CoreExtensions::FileWatcher # @param [String] path The file that changed # @return [void] 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.run_callbacks(path, :changed) end @@ -90,6 +91,7 @@ module Middleman::CoreExtensions::FileWatcher # @param [String] path The file that was deleted # @return [void] 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.run_callbacks(path, :deleted) end diff --git a/middleman-core/lib/middleman-core/watcher.rb b/middleman-core/lib/middleman-core/watcher.rb index 553b91e7..28fbbb9a 100644 --- a/middleman-core/lib/middleman-core/watcher.rb +++ b/middleman-core/lib/middleman-core/watcher.rb @@ -23,7 +23,10 @@ module Middleman [ /\.sass-cache/, /\.git/, - /\.DS_Store/ + /\.DS_Store/, + /build/, + /\.rbenv-version/, + /Gemfile/ ] end end @@ -76,7 +79,7 @@ module Middleman set :environment, env set :logging, is_logging end - $stderr.puts "Is logging?: #{is_logging}" + app_rack = app.class.to_rack_app opts = @options.dup