vendor/sass/vendor/fssm/lib/fssm/support.rb in haml-3.1.8 vs vendor/sass/vendor/fssm/lib/fssm/support.rb in haml-3.2.0.alpha.2
- old
+ new
@@ -1,83 +1,54 @@
require 'rbconfig'
module FSSM::Support
class << self
- def usable_backend
- choice = case
- when mac? && !lion? && !jruby? && carbon_core?
- 'FSEvents'
- when mac? && rb_fsevent?
- 'RBFSEvent'
- when linux? && rb_inotify?
- 'Inotify'
- else
- 'Polling'
- end
-
- if (mac? || linux?) && choice == 'Polling'
- optimal = case
- when mac?
- 'rb-fsevent'
- when linux?
- 'rb-inotify'
- end
- FSSM.dbg("An optimized backend is available for this platform!")
- FSSM.dbg(" gem install #{optimal}")
+ def backend
+ @@backend ||= case
+ when mac? && !jruby? && carbon_core?
+ 'FSEvents'
+ when linux? && rb_inotify?
+ 'Inotify'
+ else
+ 'Polling'
end
-
- choice
end
- def backend
- @@backend ||= usable_backend
- end
-
def jruby?
defined?(JRUBY_VERSION)
end
def mac?
Config::CONFIG['target_os'] =~ /darwin/i
end
- def lion?
- Config::CONFIG['target_os'] =~ /darwin11/i
- end
-
def linux?
Config::CONFIG['target_os'] =~ /linux/i
end
def carbon_core?
begin
require 'osx/foundation'
OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework'
true
rescue LoadError
+ STDERR.puts("Warning: Unable to load CarbonCore. FSEvents will be unavailable.")
false
end
end
- def rb_fsevent?
- begin
- require 'rb-fsevent'
- defined?(FSEvent::VERSION) ? FSEvent::VERSION.to_f >= 0.4 : false
- rescue LoadError
- false
- end
- end
-
def rb_inotify?
- begin
+ found = begin
require 'rb-inotify'
if defined?(INotify::VERSION)
version = INotify::VERSION
version[0] > 0 || version[1] >= 6
end
rescue LoadError
false
end
+ STDERR.puts("Warning: Unable to load rb-inotify >= 0.5.1. Inotify will be unavailable.") unless found
+ found
end
def use_block(context, block)
return if block.nil?
if block.arity == 1