Class: Rake::DataTask::DataTask

Inherits:
Task
  • Object
show all
Defined in:
lib/data_task.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, app) ⇒ DataTask

Instantiate a new DataTask.



21
22
23
24
# File 'lib/data_task.rb', line 21

def initialize(data, app)
  super
  @data = data
end

Class Method Details

.scope_name(scope, task_name) ⇒ Object

Apply the scope to the task name according to the rules for this kind of task. Table based tasks ignore the scope when creating the name.



61
62
63
# File 'lib/data_task.rb', line 61

def scope_name(scope, task_name)
  task_name
end

Instance Method Details

#needed?Boolean

Is this table task needed? Yes if it doesn’t exist, or if its time stamp is out of date.



28
29
30
# File 'lib/data_task.rb', line 28

def needed?
  !@data.exist? || out_of_date?(timestamp)
end

#timestampObject

Time stamp for data task.



33
34
35
36
37
38
39
40
41
# File 'lib/data_task.rb', line 33

def timestamp
  if @data.exist?
    mtime = @data.mtime.to_time
    raise "Table #{name} exists but modified time is unavailable." if mtime.nil?
    mtime
  else
    Rake::EARLY
  end
end