Class: Dply::Cli::Task

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/dply/cli/task.rb

Instance Method Summary collapse

Methods included from Logger

#debug?, #logger, stderr, #stderr

Constructor Details

#initialize(argv) ⇒ Task

Returns a new instance of Task.



12
13
14
# File 'lib/dply/cli/task.rb', line 12

def initialize(argv)
  @argv = argv
end

Instance Method Details

#configObject



27
28
29
# File 'lib/dply/cli/task.rb', line 27

def config
  @config ||= Config.new.to_struct
end

#lockObject



31
32
33
# File 'lib/dply/cli/task.rb', line 31

def lock
  @lock ||= Lock.new
end

#runObject



16
17
18
19
20
21
# File 'lib/dply/cli/task.rb', line 16

def run
  task_name = @argv.shift
  error "task name not specified" if not task_name
  lock.acquire
  strategy.task(task_name)
end

#strategyObject



23
24
25
# File 'lib/dply/cli/task.rb', line 23

def strategy
  @strategy ||= Strategy.load(config, {})
end