diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a719800..989b3eac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Master * Avoid looking in binary files for frontmatter. #728 * Allow nested i18n files. #725 * Better adapt to Rack interface. #709 +* Add --force-polling flag. #730, #644 3.0.9 ==== diff --git a/middleman-core/lib/middleman-core/cli/server.rb b/middleman-core/lib/middleman-core/cli/server.rb index 81edf838..e69c9970 100644 --- a/middleman-core/lib/middleman-core/cli/server.rb +++ b/middleman-core/lib/middleman-core/cli/server.rb @@ -29,7 +29,7 @@ module Middleman::Cli :type => :string, :default => false, :desc => 'Print instrument messages' - method_option "disable-watcher", + method_option :disable_watcher, :type => :boolean, :default => false, :desc => 'Disable the file change and delete watcher process' @@ -41,6 +41,10 @@ module Middleman::Cli :type => :string, :default => false, :desc => 'Additional paths to auto-reload when files change' + method_option :force_polling, + :type => :boolean, + :default => false, + :desc => 'Force file watcher into polling mode' # Start the server def server @@ -60,8 +64,9 @@ module Middleman::Cli :environment => options["environment"], :debug => options["verbose"], :instrumenting => options["instrument"], - :"disable-watcher" => options["disable-watcher"], - :reload_paths => options["reload_paths"] + :disable_watcher => options["disable_watcher"], + :reload_paths => options["reload_paths"], + :force_polling => options["force_polling"] } puts "== The Middleman is loading" diff --git a/middleman-core/lib/middleman-core/preview_server.rb b/middleman-core/lib/middleman-core/preview_server.rb index 87e3b290..b78b8761 100644 --- a/middleman-core/lib/middleman-core/preview_server.rb +++ b/middleman-core/lib/middleman-core/preview_server.rb @@ -81,14 +81,14 @@ module Middleman end def start_file_watcher - return if @options[:"disable-watcher"] + return if @options[:disable_watcher] first_run = !@listener if first_run # Watcher Library require "listen" - @listener = Listen.to(Dir.pwd, :relative_paths => true) + @listener = Listen.to(Dir.pwd, :relative_paths => true, :force_polling => @options[:force_polling]) end @listener.change do |modified, added, removed|