Sha256: 8fd8cf108edddece995e4c781e7de85afae3e84493a584de10aa59c6d3e9a09f
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
module Guard # Listener implementation for Windows `fchange`. # class Windows < Listener # Initialize the Listener. # def initialize(*) super @fchange = FChange::Notifier.new end # Start the listener. # def start super worker.run end # Stop the listener. # def stop super worker.stop end # Check if the listener is usable on the current OS. # # @return [Boolean] whether usable or not # def self.usable? require 'rb-fchange' true rescue LoadError UI.info 'Please install rb-fchange gem for Windows file events support' false end private # Watch the given directory for file changes. # # @param [String] directory the directory to watch # def watch(directory) worker.watch(directory, :all_events, :recursive) do |event| paths = [File.expand_path(event.watcher.path)] files = modified_files(paths, :all => true) @callback.call(files) unless files.empty? end end # Get the listener worker. # def worker @fchange end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
guard-0.8.4 | lib/guard/listeners/windows.rb |
guard-0.8.3 | lib/guard/listeners/windows.rb |
guard-0.8.2 | lib/guard/listeners/windows.rb |
guard-0.8.0 | lib/guard/listeners/windows.rb |