Module: Abid::TaskManager

Included in:
Application
Defined in:
lib/abid/task_manager.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.record_task_metadataObject

:nodoc:



56
57
58
# File 'lib/abid/task_manager.rb', line 56

def  # :nodoc:
  Rake::TaskManager.
end

Instance Method Details

#[](task_name, scopes = nil, **params) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/abid/task_manager.rb', line 20

def [](task_name, scopes = nil, **params)
  task = super(task_name, scopes)

  if task.respond_to? :bind
    task.bind(**params)
  else
    task
  end
end

#define_mixin(task_class, mixin_name, &block) ⇒ Object



14
15
16
17
18
# File 'lib/abid/task_manager.rb', line 14

def define_mixin(task_class, mixin_name, &block)
  define_task(task_class, mixin_name).tap do |task|
    task.mixin_definition = block
  end
end

#define_play(task_class, play_name, extends: nil, &block) ⇒ Object



7
8
9
10
11
12
# File 'lib/abid/task_manager.rb', line 7

def define_play(task_class, play_name, extends: nil, &block)
  define_task(task_class, play_name).tap do |task|
    task.extends = extends
    task.play_class_definition = block
  end
end

#initializeObject



3
4
5
# File 'lib/abid/task_manager.rb', line 3

def initialize
  super
end

#lookup_play_class(task_name, scope = nil) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/abid/task_manager.rb', line 38

def lookup_play_class(task_name, scope = nil)
  if task_name.nil?
    play_base
  elsif task_name.is_a? Class
    task_name
  else
    t = lookup(task_name.to_s, scope)
    if t.respond_to? :play_class
      t.play_class
    elsif t.nil?
      fail "play #{task_name} not found"
    else
      fail "task #{task_name} has no play class"
    end
  end
end

#play_base(&block) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/abid/task_manager.rb', line 30

def play_base(&block)
  if block_given?
    @play_base = Class.new(Abid::Play, &block)
  else
    @play_base ||= Abid::Play
  end
end