Class: FeduxOrgStdlib::Rake::SubTask

Inherits:
Task
  • Object
show all
Defined in:
lib/fedux_org_stdlib/rake/sub_task.rb

Overview

Sub Task

This class can be used to call other defined rake-tasks

See Also:

  • Rakefile

Instance Attribute Summary collapse

Attributes inherited from Task

#description, #name, #verbose, #verbose (true)

Instance Method Summary collapse

Methods inherited from Task

#include, #instance_binding

Constructor Details

#initialize(sub_tasks:, **args) ⇒ SubTask

Create a new sub task task

Parameters:

  • sub_tasks (Array)

    A list of sub tasks, e.g. ‘namespace1:task1’, ‘task2’



20
21
22
23
24
25
26
27
# File 'lib/fedux_org_stdlib/rake/sub_task.rb', line 20

def initialize(
  sub_tasks:,
  **args
)
  super(**args)

  @sub_tasks = Array(sub_tasks)
end

Instance Attribute Details

#commandObject (readonly)

The command to be executed



14
# File 'lib/fedux_org_stdlib/rake/sub_task.rb', line 14

attr_reader :sub_tasks

#sub_tasksObject (readonly)

Returns the value of attribute sub_tasks.



14
15
16
# File 'lib/fedux_org_stdlib/rake/sub_task.rb', line 14

def sub_tasks
  @sub_tasks
end

Instance Method Details

#run_task(_verbose) ⇒ Object



30
31
32
# File 'lib/fedux_org_stdlib/rake/sub_task.rb', line 30

def run_task(_verbose)
  sub_tasks.each { |t| ::Rake::Task[t].invoke }
end