Class: Rant::FileTask
- Inherits:
-
Task
show all
- Defined in:
- lib/rant/import/nodes/default.rb
Overview
Instance Attribute Summary
Attributes inherited from Task
#receiver
Instance Method Summary
collapse
Methods inherited from Task
#<<, #each_dep, #enhance, #fail?, #has_actions?, #invoked?, #prerequisites, #source
Methods included from Node
#inspect
Constructor Details
#initialize(*args) ⇒ FileTask
Returns a new instance of FileTask.
303
304
305
306
|
# File 'lib/rant/import/nodes/default.rb', line 303
def initialize(*args)
super
@ts = T0
end
|
Instance Method Details
#each_target {|name| ... } ⇒ Object
362
363
364
365
|
# File 'lib/rant/import/nodes/default.rb', line 362
def each_target
goto_task_home
yield name
end
|
#file_target? ⇒ Boolean
308
309
310
|
# File 'lib/rant/import/nodes/default.rb', line 308
def file_target?
true
end
|
#handle_node(dep, opt) ⇒ Object
334
335
336
337
338
339
340
341
342
343
344
|
# File 'lib/rant/import/nodes/default.rb', line 334
def handle_node(dep, opt)
return true if dep.file_target? && dep.invoke(opt)
if File.exist? dep.name
File.mtime(dep.name) > @ts
elsif !dep.file_target?
@rac.err_msg @rac.pos_text(rantfile.path, line_number),
"in prerequisites: no such file: `#{dep.full_name}'"
self.fail
end
end
|
#handle_non_node(dep, opt) ⇒ Object
352
353
354
355
356
357
358
359
360
|
# File 'lib/rant/import/nodes/default.rb', line 352
def handle_non_node(dep, opt)
goto_task_home unless File.exist? dep
@rac.err_msg @rac.pos_text(rantfile.path, line_number),
"in prerequisites: no such file or task: `#{dep}'"
self.fail
end
[dep, File.mtime(dep) > @ts]
end
|
#handle_timestamped(dep, opt) ⇒ Object
346
347
348
349
350
|
# File 'lib/rant/import/nodes/default.rb', line 346
def handle_timestamped(dep, opt)
return true if dep.invoke opt
dep.timestamp(opt) > @ts
end
|
#invoke(opt = INVOKE_OPT) ⇒ Object
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
# File 'lib/rant/import/nodes/default.rb', line 312
def invoke(opt = INVOKE_OPT)
return circular_dep if @run
@run = true
begin
return if done?
goto_task_home
if File.exist? @name
@ts = File.mtime @name
internal_invoke opt, false
else
@ts = T0
internal_invoke opt, true
end
ensure
@run = false
end
end
|
#timestamp(opt = INVOKE_OPT) ⇒ Object
330
331
332
|
# File 'lib/rant/import/nodes/default.rb', line 330
def timestamp(opt = INVOKE_OPT)
File.exist?(@name) ? File.mtime(@name) : T0
end
|