class Schlepper::Task
Tasks live in your rails app under /script/tasks. They have the same filename pattern as rails migrations, {version time stamp}_class_name.rb A functional generator is provided using `rails generate schlepper:task name_of_task`
Public Class Methods
children()
click to toggle source
# File lib/schlepper/task.rb, line 10 def self.children @children end
inherited(obj)
click to toggle source
Calls superclass method
# File lib/schlepper/task.rb, line 14 def self.inherited obj super children.push obj end
Public Instance Methods
controls_transaction?()
click to toggle source
Signals to the task runner that this task will control its own transaction. When true the task runner will not open a transaction. Use with caution. @return [Boolean]
# File lib/schlepper/task.rb, line 30 def controls_transaction? false end
description()
click to toggle source
# File lib/schlepper/task.rb, line 36 def description end
owner()
click to toggle source
# File lib/schlepper/task.rb, line 41 def owner end
run()
click to toggle source
# File lib/schlepper/task.rb, line 51 def run end
version_number()
click to toggle source
@return [Fixnum] The version number of the current class
# File lib/schlepper/task.rb, line 20 def version_number # We have to find the actual file where the class is defined which is the reason for # the method source location weirdness @version_number ||= File.basename(method(:run).source_location.first).scan(/\A(\d{10,})/).first.first end