From d37eca6a5456ce5dbb1563d9476af370891331fe Mon Sep 17 00:00:00 2001 From: Mark-Simulacrum Date: Tue, 20 Aug 2013 06:32:49 -0600 Subject: [PATCH 1/4] Add latency option. Aliased to -l. --- middleman-core/lib/middleman-core/cli/server.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/middleman-core/lib/middleman-core/cli/server.rb b/middleman-core/lib/middleman-core/cli/server.rb index e69c9970..4387147b 100644 --- a/middleman-core/lib/middleman-core/cli/server.rb +++ b/middleman-core/lib/middleman-core/cli/server.rb @@ -45,6 +45,11 @@ module Middleman::Cli :type => :boolean, :default => false, :desc => 'Force file watcher into polling mode' + method_option :latency, + :type => :string, + :aliases => "-l", + :default => "0.25", + :desc => 'Set file watcher latency, in seconds' # Start the server def server @@ -67,6 +72,7 @@ module Middleman::Cli :disable_watcher => options["disable_watcher"], :reload_paths => options["reload_paths"], :force_polling => options["force_polling"] + :latency => options["latency"] } puts "== The Middleman is loading" From 24ce8334eec564fa0dd93703e337182ec591db6f Mon Sep 17 00:00:00 2001 From: Mark-Simulacrum Date: Tue, 20 Aug 2013 06:36:51 -0600 Subject: [PATCH 2/4] Add latency option to listener object. --- middleman-core/lib/middleman-core/preview_server.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/middleman-core/lib/middleman-core/preview_server.rb b/middleman-core/lib/middleman-core/preview_server.rb index af6537ef..34c55cb6 100644 --- a/middleman-core/lib/middleman-core/preview_server.rb +++ b/middleman-core/lib/middleman-core/preview_server.rb @@ -104,6 +104,7 @@ module Middleman # Watcher Library require "listen" @listener = Listen.to(Dir.pwd, :relative_paths => true, :force_polling => @options[:force_polling]) + @listener.latency(@options[:latency]) end @listener.change do |modified, added, removed| From c12d98df4f2ec3e998f3fc8703227c7944e89a13 Mon Sep 17 00:00:00 2001 From: Mark-Simulacrum Date: Tue, 20 Aug 2013 15:59:38 -0600 Subject: [PATCH 3/4] add comma at end of line 74 --- middleman-core/lib/middleman-core/cli/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/cli/server.rb b/middleman-core/lib/middleman-core/cli/server.rb index 4387147b..2c024355 100644 --- a/middleman-core/lib/middleman-core/cli/server.rb +++ b/middleman-core/lib/middleman-core/cli/server.rb @@ -71,7 +71,7 @@ module Middleman::Cli :instrumenting => options["instrument"], :disable_watcher => options["disable_watcher"], :reload_paths => options["reload_paths"], - :force_polling => options["force_polling"] + :force_polling => options["force_polling"], :latency => options["latency"] } From 7606dfd494c856bcd8d2250c25fff536c7ca20a5 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Wed, 21 Aug 2013 05:33:29 -0600 Subject: [PATCH 4/4] Change latency option to :numeric type. --- middleman-core/lib/middleman-core/cli/server.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middleman-core/lib/middleman-core/cli/server.rb b/middleman-core/lib/middleman-core/cli/server.rb index 2c024355..931b69de 100644 --- a/middleman-core/lib/middleman-core/cli/server.rb +++ b/middleman-core/lib/middleman-core/cli/server.rb @@ -46,9 +46,9 @@ module Middleman::Cli :default => false, :desc => 'Force file watcher into polling mode' method_option :latency, - :type => :string, + :type => :numeric, :aliases => "-l", - :default => "0.25", + :default => 0.25, :desc => 'Set file watcher latency, in seconds' # Start the server