Module: FSSM::Support
- Defined in:
- lib/fssm/support.rb
Class Method Summary collapse
- .backend ⇒ Object
- .carbon_core? ⇒ Boolean
- .jruby? ⇒ Boolean
- .linux? ⇒ Boolean
- .mac? ⇒ Boolean
- .rb_inotify? ⇒ Boolean
Class Method Details
.backend ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fssm/support.rb', line 5 def backend @@backend ||= case when mac? && !jruby? && carbon_core? 'FSEvents' when linux? && rb_inotify? 'Inotify' else 'Polling' end end |
.carbon_core? ⇒ Boolean
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fssm/support.rb', line 28 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 |
.jruby? ⇒ Boolean
16 17 18 |
# File 'lib/fssm/support.rb', line 16 def jruby? defined?(JRUBY_VERSION) end |
.linux? ⇒ Boolean
24 25 26 |
# File 'lib/fssm/support.rb', line 24 def linux? Config::CONFIG['target_os'] =~ /linux/i end |
.mac? ⇒ Boolean
20 21 22 |
# File 'lib/fssm/support.rb', line 20 def mac? Config::CONFIG['target_os'] =~ /darwin/i end |
.rb_inotify? ⇒ Boolean
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fssm/support.rb', line 39 def rb_inotify? begin require 'rubygems' require 'rb-inotify' true rescue LoadError, Gem::LoadError STDERR.puts("Warning: Unable to load rb-inotify. Inotify will be unavailable.") false end end |