lib/watchr.rb in watchr-0.5.3 vs lib/watchr.rb in watchr-0.5.4
- old
+ new
@@ -58,17 +58,40 @@
#
def debug(str)
puts "[watchr debug] #{str}" if options.debug
end
+ # Detect current OS and return appropriate handler.
+ #
+ # NOTE temporarily returns Portable handler for all platforms, until
+ # issue #1 is fixed
+ #
+ # ===== Examples
+ #
+ # Config::CONFIG['host_os'] #=> 'linux-gnu'
+ # Watchr.handler #=> Watchr::EventHandler::Unix
+ #
+ # Config::CONFIG['host_os'] #=> 'cygwin'
+ # Watchr.handler #=> Watchr::EventHandler::Portable
+ #
+ # ENV['HANDLER'] #=> 'unix'
+ # Watchr.handler #=> Watchr::EventHandler::Unix
+ #
+ # ENV['HANDLER'] #=> 'portable'
+ # Watchr.handler #=> Watchr::EventHandler::Portable
+ #
+ # ===== Returns
+ # handler<Class>:: handler class for current architecture
+ #
def handler
@handler ||=
#case ENV['HANDLER'] || RUBY_PLATFORM
case ENV['HANDLER'] || Config::CONFIG['host_os']
when /mswin|windows|cygwin/i
Watchr::EventHandler::Portable
- when /bsd|sunos|solaris|darwin|osx|mach|linux/i, 'unix'
- Watchr::EventHandler::Unix
+ when /sunos|solaris|darwin|mach|osx|bsd|linux/i, 'unix'
+ #Watchr::EventHandler::Unix
+ Watchr::EventHandler::Portable
else
Watchr::EventHandler::Portable
end
end
end