From cefb87236085e35fd49eb97f6db0dfb51b296a30 Mon Sep 17 00:00:00 2001 From: Bruno Tavares Date: Thu, 5 May 2011 20:14:58 -0300 Subject: [PATCH 1/2] Changed some conditions to positive statement --- lib/guard/listeners/darwin.rb | 2 +- lib/guard/listeners/linux.rb | 4 ++-- lib/guard/listeners/polling.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/guard/listeners/darwin.rb b/lib/guard/listeners/darwin.rb index c6eb055..775a368 100644 --- a/lib/guard/listeners/darwin.rb +++ b/lib/guard/listeners/darwin.rb @@ -25,7 +25,7 @@ module Guard def self.usable? require 'rb-fsevent' - if !defined?(FSEvent::VERSION) || Gem::Version.new(FSEvent::VERSION) < Gem::Version.new('0.3.9') + unless defined?(FSEvent::VERSION) || Gem::Version.new(FSEvent::VERSION) >= Gem::Version.new('0.3.9') UI.info "Please update rb-fsevent (>= 0.3.9)" false else diff --git a/lib/guard/listeners/linux.rb b/lib/guard/listeners/linux.rb index 6436d59..f7c5668 100644 --- a/lib/guard/listeners/linux.rb +++ b/lib/guard/listeners/linux.rb @@ -32,7 +32,7 @@ module Guard def self.usable? require 'rb-inotify' - if !defined?(INotify::VERSION) || Gem::Version.new(INotify::VERSION.join('.')) < Gem::Version.new('0.5.1') + unless defined?(INotify::VERSION) || Gem::Version.new(INotify::VERSION.join('.')) >= Gem::Version.new('0.5.1') UI.info "Please update rb-inotify (>= 0.5.1)" false else @@ -51,7 +51,7 @@ module Guard def watch_change @watch_change = true - while !@stop + until @stop if Config::CONFIG['build'] =~ /java/ || IO.select([inotify.to_io], [], [], latency) break if @stop diff --git a/lib/guard/listeners/polling.rb b/lib/guard/listeners/polling.rb index e0dd5ca..bf5a17b 100644 --- a/lib/guard/listeners/polling.rb +++ b/lib/guard/listeners/polling.rb @@ -23,7 +23,7 @@ module Guard private def watch_change - while !@stop + until @stop start = Time.now.to_f files = modified_files([Dir.pwd + '/'], :all => true) update_last_event From ed0b086cc5885018527a7fca5ca82345c03306d6 Mon Sep 17 00:00:00 2001 From: Bruno Tavares Date: Thu, 5 May 2011 20:52:11 -0300 Subject: [PATCH 2/2] Removed the unless with multiple conditions. Changed it back to if --- lib/guard/listeners/darwin.rb | 2 +- lib/guard/listeners/linux.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/guard/listeners/darwin.rb b/lib/guard/listeners/darwin.rb index 775a368..c6eb055 100644 --- a/lib/guard/listeners/darwin.rb +++ b/lib/guard/listeners/darwin.rb @@ -25,7 +25,7 @@ module Guard def self.usable? require 'rb-fsevent' - unless defined?(FSEvent::VERSION) || Gem::Version.new(FSEvent::VERSION) >= Gem::Version.new('0.3.9') + if !defined?(FSEvent::VERSION) || Gem::Version.new(FSEvent::VERSION) < Gem::Version.new('0.3.9') UI.info "Please update rb-fsevent (>= 0.3.9)" false else diff --git a/lib/guard/listeners/linux.rb b/lib/guard/listeners/linux.rb index f7c5668..2d53b62 100644 --- a/lib/guard/listeners/linux.rb +++ b/lib/guard/listeners/linux.rb @@ -32,7 +32,7 @@ module Guard def self.usable? require 'rb-inotify' - unless defined?(INotify::VERSION) || Gem::Version.new(INotify::VERSION.join('.')) >= Gem::Version.new('0.5.1') + if !defined?(INotify::VERSION) || Gem::Version.new(INotify::VERSION.join('.')) < Gem::Version.new('0.5.1') UI.info "Please update rb-inotify (>= 0.5.1)" false else