Skip to content

Commit

Permalink
Reenable evented handler. Fixes issue mynyml#1
Browse files Browse the repository at this point in the history
To use the evented handler, rev must be installed beforehand. Watchr
will pick it up automatically, but does not declare it as a gem
dependency anymore.
  • Loading branch information
mynyml committed Sep 25, 2009
1 parent f12944f commit efae6ec
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 36 deletions.
9 changes: 6 additions & 3 deletions lib/watchr.rb
Expand Up @@ -84,13 +84,16 @@ def debug(str)
#
def handler
@handler ||=
#case ENV['HANDLER'] || RUBY_PLATFORM
case ENV['HANDLER'] || Config::CONFIG['host_os']
when /mswin|windows|cygwin/i
Watchr::EventHandler::Portable
when /sunos|solaris|darwin|mach|osx|bsd|linux/i, 'unix'
#Watchr::EventHandler::Unix
Watchr::EventHandler::Portable
begin
require 'rev'
Watchr::EventHandler::Unix
rescue LoadError, RuntimeError
Watchr::EventHandler::Portable
end
else
Watchr::EventHandler::Portable
end
Expand Down
2 changes: 0 additions & 2 deletions test/event_handlers/test_unix.rb
@@ -1,4 +1,3 @@
=begin
require 'test/test_helper'

class UnixEventHandlerTest < Test::Unit::TestCase
Expand Down Expand Up @@ -55,4 +54,3 @@ def teardown
@loop.watchers.every.path.should exclude('bar')
end
end
=end
29 changes: 4 additions & 25 deletions test/test_watchr.rb
Expand Up @@ -24,42 +24,21 @@ def setup

test "picking handler" do

# temporary workaround to issue #1
# http://github.com/mynyml/watchr/issues#issue/1

#Watchr.handler = nil
#ENV['HANDLER'] = 'linux'
#Watchr.handler.should be(Watchr::EventHandler::Unix)

#Watchr.handler = nil
#ENV['HANDLER'] = 'bsd'
#Watchr.handler.should be(Watchr::EventHandler::Unix)

#Watchr.handler = nil
#ENV['HANDLER'] = 'darwin'
#Watchr.handler.should be(Watchr::EventHandler::Unix)

#Watchr.handler = nil
#ENV['HANDLER'] = 'unix'
#Watchr.handler.should be(Watchr::EventHandler::Unix)

Watchr.handler = nil
ENV['HANDLER'] = 'linux'
Watchr.handler.should be(Watchr::EventHandler::Portable)
Watchr.handler.should be(Watchr::EventHandler::Unix)

Watchr.handler = nil
ENV['HANDLER'] = 'bsd'
Watchr.handler.should be(Watchr::EventHandler::Portable)
Watchr.handler.should be(Watchr::EventHandler::Unix)

Watchr.handler = nil
ENV['HANDLER'] = 'darwin'
Watchr.handler.should be(Watchr::EventHandler::Portable)
Watchr.handler.should be(Watchr::EventHandler::Unix)

Watchr.handler = nil
ENV['HANDLER'] = 'unix'
Watchr.handler.should be(Watchr::EventHandler::Portable)
# end temporary workaround

Watchr.handler.should be(Watchr::EventHandler::Unix)

Watchr.handler = nil
ENV['HANDLER'] = 'mswin'
Expand Down
6 changes: 0 additions & 6 deletions watchr.gemspec
Expand Up @@ -48,12 +48,6 @@ Gem::Specification.new do |s|
test/event_handlers/test_portable.rb
]

#require 'rbconfig'
#unless Config::CONFIG['host_os'] =~ /mswin|windows|cygwin/i
#unless RUBY_PLATFORM =~ /mswin|windows|cygwin/i
# s.add_dependency 'rev', '>= 0.3.0'
#end

s.add_development_dependency 'mocha'
s.add_development_dependency 'jeremymcanally-matchy'
s.add_development_dependency 'jeremymcanally-pending'
Expand Down

0 comments on commit efae6ec

Please sign in to comment.