mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
Merge pull request #992 from Mark-Simulacrum/master
Add listener latency option.
This commit is contained in:
commit
abfe5e673f
2 changed files with 8 additions and 1 deletions
|
@ -45,6 +45,11 @@ module Middleman::Cli
|
||||||
:type => :boolean,
|
:type => :boolean,
|
||||||
:default => false,
|
:default => false,
|
||||||
:desc => 'Force file watcher into polling mode'
|
:desc => 'Force file watcher into polling mode'
|
||||||
|
method_option :latency,
|
||||||
|
:type => :numeric,
|
||||||
|
:aliases => "-l",
|
||||||
|
:default => 0.25,
|
||||||
|
:desc => 'Set file watcher latency, in seconds'
|
||||||
|
|
||||||
# Start the server
|
# Start the server
|
||||||
def server
|
def server
|
||||||
|
@ -66,7 +71,8 @@ module Middleman::Cli
|
||||||
:instrumenting => options["instrument"],
|
:instrumenting => options["instrument"],
|
||||||
:disable_watcher => options["disable_watcher"],
|
:disable_watcher => options["disable_watcher"],
|
||||||
:reload_paths => options["reload_paths"],
|
:reload_paths => options["reload_paths"],
|
||||||
:force_polling => options["force_polling"]
|
:force_polling => options["force_polling"],
|
||||||
|
:latency => options["latency"]
|
||||||
}
|
}
|
||||||
|
|
||||||
puts "== The Middleman is loading"
|
puts "== The Middleman is loading"
|
||||||
|
|
|
@ -104,6 +104,7 @@ module Middleman
|
||||||
# Watcher Library
|
# Watcher Library
|
||||||
require "listen"
|
require "listen"
|
||||||
@listener = Listen.to(Dir.pwd, :relative_paths => true, :force_polling => @options[:force_polling])
|
@listener = Listen.to(Dir.pwd, :relative_paths => true, :force_polling => @options[:force_polling])
|
||||||
|
@listener.latency(@options[:latency])
|
||||||
end
|
end
|
||||||
|
|
||||||
@listener.change do |modified, added, removed|
|
@listener.change do |modified, added, removed|
|
||||||
|
|
Loading…
Reference in a new issue