Add --force-polling flag to server. Closes #730. Closes #644

This commit is contained in:
Thomas Reynolds 2013-01-13 11:56:53 -08:00
parent 18da6362ba
commit d4f5e4db29
3 changed files with 11 additions and 5 deletions

View file

@ -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
====

View file

@ -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"

View file

@ -80,14 +80,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|