Module: Build::Files
- Defined in:
- lib/build/files/glob.rb,
lib/build/files/list.rb,
lib/build/files/path.rb,
lib/build/files/paths.rb,
lib/build/files/state.rb,
lib/build/files/system.rb,
lib/build/files/monitor.rb,
lib/build/files/version.rb,
lib/build/files/directory.rb
Defined Under Namespace
Classes: Composite, Directory, FileTime, Glob, Handle, List, Monitor, Path, Paths, State
Constant Summary
collapse
- VERSION =
"1.0.5"
Class Method Summary
collapse
Class Method Details
.run_with_fsevent(monitor, options = {}, &block) ⇒ Object
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# File 'lib/build/files/monitor.rb', line 195
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|
directories.collect!{|directory| File.expand_path(directory)}
monitor.update(directories)
yield
if monitor.updated
notifier.stop
end
end
notifier.run
end
end
end
|
.run_with_inotify(monitor, options = {}, &block) ⇒ Object
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
# File 'lib/build/files/monitor.rb', line 171
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, :attrib, :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
219
220
221
222
223
224
225
226
227
228
229
|
# File 'lib/build/files/monitor.rb', line 219
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
|