Class: Build::Files::Monitor::FSEvent

Inherits:
Polling
  • Object
show all
Defined in:
lib/build/files/monitor/fsevent.rb

Instance Attribute Summary

Attributes inherited from Polling

#updated

Instance Method Summary collapse

Methods inherited from Polling

#add, #delete, #initialize, #roots, #track_changes, #update

Constructor Details

This class inherits a constructor from Build::Files::Monitor::Polling

Instance Method Details

#run(**options, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/build/files/monitor/fsevent.rb', line 29

def run(**options, &block)
	notifier = ::FSEvent.new
	
	catch(:interrupt) do
		while true
			notifier.watch self.roots do |directories|
				directories.collect! do |directory|
					File.expand_path(directory)
				end
				
				self.update(directories)
				
				yield
				
				if self.updated
					notifier.stop
				end
			end
			
			notifier.run
		end
	end
end