Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated references from Rev to Coolio. #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ Install

gem install watchr

If you're on Linux/BSD and have the [rev][4] gem installed, Watchr will detect
If you're on Linux/BSD and have the [cool.io][4] gem installed, Watchr will detect
it and use it automatically. This will make Watchr evented.

gem install rev
gem install coolio

You can get the same evented behaviour on OS X by installing
[ruby-fsevent][10].
Expand Down Expand Up @@ -109,7 +109,7 @@ Links
[1]: http://github.com/mynyml/watchr/blob/master/specs.watchr
[2]: http://github.com/mynyml/watchr/blob/master/docs.watchr
[3]: http://github.com/mynyml/watchr/blob/master/gem.watchr
[4]: http://github.com/tarcieri/rev/
[4]: https://github.com/tarcieri/cool.io
[5]: http://wiki.github.com/mynyml/watchr
[6]: http://github.com/mynyml/redgreen
[7]: http://github.com/mynyml/phocus
Expand Down
12 changes: 6 additions & 6 deletions lib/watchr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ module Watchr
end

begin
require 'rev'
HAVE_REV = true
require 'coolio'
HAVE_COOLIO = true
rescue LoadError, RuntimeError
HAVE_REV = false
HAVE_COOLIO = false
end

autoload :Script, 'watchr/script'
Expand All @@ -36,7 +36,7 @@ module Watchr
module EventHandler
autoload :Base, 'watchr/event_handlers/base'
autoload :Portable, 'watchr/event_handlers/portable'
autoload :Unix, 'watchr/event_handlers/unix' if ::Watchr::HAVE_REV
autoload :Unix, 'watchr/event_handlers/unix' if ::Watchr::HAVE_COOLIO
autoload :Darwin, 'watchr/event_handlers/darwin' if ::Watchr::HAVE_FSE
end

Expand Down Expand Up @@ -117,10 +117,10 @@ def handler
Watchr::EventHandler::Portable
end
when /sunos|solaris|bsd|linux|unix/i
if Watchr::HAVE_REV
if Watchr::HAVE_COOLIO
Watchr::EventHandler::Unix
else
Watchr.debug "rev not found. `gem install rev` to get evented handler"
Watchr.debug "coolio not found. `gem install coolio` to get evented handler"
Watchr::EventHandler::Portable
end
when /mswin|windows|cygwin/i
Expand Down
6 changes: 3 additions & 3 deletions lib/watchr/event_handlers/unix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module EventHandler
class Unix
include Base

# Used by Rev. Wraps a monitored path, and `Rev::Loop` will call its
# Used by Coolio. Wraps a monitored path, and `Coolio::Loop` will call its
# callback on file events.
#
# @private
class SingleFileWatcher < Rev::StatWatcher
class SingleFileWatcher < Coolio::StatWatcher
class << self
# Stores a reference back to handler so we can call its {Base#notify notify}
# method with file event info
Expand Down Expand Up @@ -75,7 +75,7 @@ def type

def initialize
SingleFileWatcher.handler = self
@loop = Rev::Loop.default
@loop = Coolio::Loop.default
end

# Enters listening loop. Will block control flow until application is
Expand Down
8 changes: 4 additions & 4 deletions test/event_handlers/test_unix.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'test/test_helper'

if Watchr::HAVE_REV
if Watchr::HAVE_COOLIO

class Watchr::EventHandler::Unix::SingleFileWatcher
public :type
Expand All @@ -20,15 +20,15 @@ def setup
pathname.stubs(:exist?).returns(true)
SingleFileWatcher.any_instance.stubs(:pathname).returns(pathname)

@loop = Rev::Loop.default
@loop = Coolio::Loop.default
@handler = EventHandler::Unix.new
@watcher = SingleFileWatcher.new('foo/bar')
@loop.stubs(:run)
end

def teardown
SingleFileWatcher.handler = nil
Rev::Loop.default.watchers.every.detach
Coolio::Loop.default.watchers.every.detach
end

test "triggers listening state" do
Expand Down Expand Up @@ -159,4 +159,4 @@ def trigger_event(watcher, now, *types)
end
end

end # if Watchr::HAVE_REV
end # if Watchr::HAVE_COOLIO
4 changes: 2 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def xtest(*args) end
end
end

unless Watchr::HAVE_REV
puts "Skipping Unix handler tests. Install Rev (gem install rev) to properly test full suite"
unless Watchr::HAVE_COOLIO
puts "Skipping Unix handler tests. Install Coolio (gem install coolio) to properly test full suite"
end

unless Watchr::HAVE_FSE
Expand Down
2 changes: 1 addition & 1 deletion test/test_watchr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setup

test "picking handler" do

if Watchr::HAVE_REV
if Watchr::HAVE_COOLIO

Watchr.handler = nil
ENV['HANDLER'] = 'linux'
Expand Down
2 changes: 1 addition & 1 deletion watchr.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'lib/watchr'
require './lib/watchr'

Gem::Specification.new do |s|
s.name = "watchr"
Expand Down