Skip to content

Commit

Permalink
Adapted the API calss to match the most recent listen gem version
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav Gangan committed Mar 10, 2014
1 parent b3cfaf0 commit d8fd230
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions emory.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'simplecov', '~> 0.6.4' if RUBY_VERSION =~ /1.9/
s.add_development_dependency 'rake'

s.add_runtime_dependency 'logging'
s.add_runtime_dependency 'listen'
s.add_runtime_dependency 'logging', '1.8.2'
s.add_runtime_dependency 'listen', '2.7.0'
end
7 changes: 3 additions & 4 deletions lib/emory/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ def configure_listeners(config, config_location)
watched_path = normalize_watched_path(config_location, teleport.watched_path)
LOGGER.info("Watching directory: #{watched_path}")

listener = Listen.to(watched_path)
listener = Listen.to(watched_path, &get_handler_callback(teleport.handler))
listener.ignore(teleport.ignore) unless teleport.ignore.nil?
listener.filter(teleport.filter) unless teleport.filter.nil?
listener.change(&get_handler_callback(teleport.handler))
listener.start(false)
listener.only(teleport.filter) unless teleport.filter.nil?
listener.start
end
end

Expand Down
10 changes: 4 additions & 6 deletions spec/emory/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ module Emory
mock_listener = double("listener")
Listen.stub(:to).with('watched_path').and_return(mock_listener)
mock_listener.should_receive(:ignore).with(teleport.ignore)
mock_listener.should_receive(:filter).with(teleport.filter)
mock_listener.should_receive(:change)
mock_listener.should_receive(:start).with(false)
mock_listener.should_receive(:only).with(teleport.filter)
mock_listener.should_receive(:start)

Thread.should_receive(:stop).once

Expand All @@ -58,9 +57,8 @@ module Emory
mock_listener = double("listener")
Listen.stub(:to).with('/path/to/config/watched_path').and_return(mock_listener)
mock_listener.should_receive(:ignore).with(teleport.ignore)
mock_listener.should_receive(:filter).with(teleport.filter)
mock_listener.should_receive(:change)
mock_listener.should_receive(:start).with(false)
mock_listener.should_receive(:only).with(teleport.filter)
mock_listener.should_receive(:start)

Thread.should_receive(:stop).once

Expand Down

0 comments on commit d8fd230

Please sign in to comment.