class RGitFlow::Tasks::Task

Attributes

after[RW]

Runs a Proc after the task @return [Proc] a proc to call after running the task

before[RW]

Runs a Proc before the task @return [Proc] a proc to call before running the task

dependencies[RW]

The dependencies of the task @return [Array<String>] the dependencies of the task

description[RW]

The description of the task @return [String] the task description

name[RW]

The name of the task @return [String] the task name

namespaces[RW]

The namespaces of the task @return [Array<String>] the task namespaces

Public Class Methods

new(git, name, description, namespaces = ['rgitflow'], dependencies = []) { |self| ... } click to toggle source
# File lib/rgitflow/tasks/task.rb, line 33
def initialize(git, name, description, namespaces = ['rgitflow'],
               dependencies = [])
  @git = git
  @name = name
  @description = description
  @namespaces = namespaces
  @dependencies = dependencies

  yield self if block_given?

  define
end

Protected Instance Methods

define() click to toggle source
# File lib/rgitflow/tasks/task.rb, line 48
def define
  full_name = [*@namespaces, @name].join(":")

  desc @description unless ::Rake.application.last_comment
  task full_name => @dependencies do
    before.call if before.is_a?(Proc)
    run
    after.call if after.is_a?(Proc)
  end
end
run() click to toggle source
# File lib/rgitflow/tasks/task.rb, line 59
def run
  raise NotImplementedError
end