Class: Rake::Microsecond::DirectoryTask

Inherits:
Base
  • Object
show all
Includes:
FileUtils
Defined in:
lib/rake/microsecond_task.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#timestamp

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#prerequisites_needed?

Instance Attribute Details

#pathObject

Returns the value of attribute path


44
45
46
# File 'lib/rake/microsecond_task.rb', line 44

def path
  @path
end

Class Method Details

.define_task(*args, &block) ⇒ Object


46
47
48
49
50
51
# File 'lib/rake/microsecond_task.rb', line 46

def self.define_task(*args, &block)
  task           = super(*args, &block)
  task.path      = args[0]
  task.timestamp = nil
  task
end

Instance Method Details

#execute(*args) ⇒ Object


59
60
61
62
63
# File 'lib/rake/microsecond_task.rb', line 59

def execute(*args)
  mkdir_p self.path, :verbose => false
  @timestamp = Time.now
  super(*args)
end

#needed?Boolean

Returns:

  • (Boolean)

53
54
55
56
57
# File 'lib/rake/microsecond_task.rb', line 53

def needed?
  return true if not File.directory?(self.path)
  @timestamp ||= File.stat(self.path).mtime
  prerequisites_needed?
end