can give path and options to Listener.select_and_init
This commit is contained in:
parent
a3cf121111
commit
b12769d2bf
@ -10,23 +10,23 @@ module Guard
|
||||
class Listener
|
||||
attr_reader :last_event, :sha1_checksums_hash, :directory
|
||||
|
||||
def self.select_and_init
|
||||
def self.select_and_init(*a)
|
||||
if mac? && Darwin.usable?
|
||||
Darwin.new
|
||||
Darwin.new(*a)
|
||||
elsif linux? && Linux.usable?
|
||||
Linux.new
|
||||
Linux.new(*a)
|
||||
elsif windows? && Windows.usable?
|
||||
Windows.new
|
||||
Windows.new(*a)
|
||||
else
|
||||
UI.info "Using polling (Please help us to support your system better than that.)"
|
||||
Polling.new
|
||||
Polling.new(*a)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(directory=Dir.pwd)
|
||||
def initialize(directory=Dir.pwd, options={})
|
||||
@directory = directory.to_s
|
||||
@sha1_checksums_hash = {}
|
||||
@relativate_paths = true
|
||||
@relativate_paths = options.fetch(:relativate_paths, true)
|
||||
update_last_event
|
||||
end
|
||||
|
||||
|
@ -27,6 +27,15 @@ describe Guard::Listener do
|
||||
Guard::Linux.should_receive(:new)
|
||||
subject.select_and_init
|
||||
end
|
||||
|
||||
it "forwards its arguments to the constructor" do
|
||||
subject.stub!(:mac?).and_return(true)
|
||||
Guard::Darwin.stub!(:usable?).and_return(true)
|
||||
|
||||
path, opts = 'path', {:foo => 23}
|
||||
Guard::Darwin.should_receive(:new).with(path, opts).and_return(true)
|
||||
subject.select_and_init path, opts
|
||||
end
|
||||
end
|
||||
|
||||
describe "#all_files" do
|
||||
|
Loading…
Reference in New Issue
Block a user