Module: Build::Files
- Defined in:
- lib/build/files/glob.rb,
lib/build/files/list.rb,
lib/build/files/path.rb,
lib/build/files/state.rb,
lib/build/files/monitor.rb,
lib/build/files/version.rb,
lib/build/files/directory.rb,
lib/build/files/path/filesystem.rb
Defined Under Namespace
Classes: Composite, Directory, FileTime, Glob, Handle, List, Monitor, Path, Paths, State
Constant Summary
collapse
- VERSION =
"0.3.2"
Class Method Summary
collapse
Class Method Details
.run_with_fsevent(monitor, options = {}, &block) ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# File 'lib/build/files/monitor.rb', line 174
def self.run_with_fsevent(monitor, options = {}, &block)
require 'rb-fsevent'
notifier = FSEvent.new
catch(:interrupt) do
while true
notifier.watch monitor.roots do |directories|
monitor.update(directories)
yield
if monitor.updated
notifier.stop
end
end
notifier.run
end
end
end
|
.run_with_inotify(monitor, options = {}, &block) ⇒ Object
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# File 'lib/build/files/monitor.rb', line 150
def self.run_with_inotify(monitor, options = {}, &block)
require 'rb-inotify'
notifier = INotify::Notifier.new
catch(:interrupt) do
while true
monitor.roots.each do |root|
notifier.watch root, :create, :modify, :delete do |event|
monitor.update([root])
yield
if monitor.updated
notifier.stop
end
end
end
notifier.run
end
end
end
|
.run_with_polling(monitor, options = {}, &block) ⇒ Object
196
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/build/files/monitor.rb', line 196
def self.run_with_polling(monitor, options = {}, &block)
catch(:interrupt) do
while true
monitor.update(monitor.roots)
yield
sleep(options[:latency] || 1.0)
end
end
end
|