Class: Listen::Adapter
- Inherits:
-
Object
- Object
- Listen::Adapter
- Defined in:
- lib/again/patches/listen.rb
Class Method Summary collapse
Class Method Details
.usable_and_works?(directories, options = {}) ⇒ Boolean
5 6 7 |
# File 'lib/again/patches/listen.rb', line 5 def self.usable_and_works?(directories, = {}) usable? #&& Array(directories).all? { |d| !writable?(d) || works?(d, options) } end |
.writable?(directory) ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/again/patches/listen.rb', line 9 def self.writable?(directory) test_file = "#{directory}/.listen_test" FileUtils.touch(test_file) return true rescue SystemCallError return false ensure FileUtils.rm(test_file) if File.exists?(test_file) end |