Class: CommandLineTask

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/command_line_task.rb

Instance Method Summary collapse

Constructor Details

#initialize(runner, parser) ⇒ CommandLineTask

Returns a new instance of CommandLineTask.



3
4
5
6
# File 'lib/tasks/command_line_task.rb', line 3

def initialize(runner, parser)
  @runner = runner
  @parser = parser
end

Instance Method Details

#is_configured?(files) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/tasks/command_line_task.rb', line 28

def is_configured?(files)
  return @runner.is_configured? files[:all]
end

#run(files) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tasks/command_line_task.rb', line 8

def run(files)
  all_files = files[:all]
  modified_files = files[:filtered]
  
  return nil if (!@runner.is_configured? all_files)
  return nil if (!@runner.should_run? modified_files)
 
  detail = @runner.execute
  
  state, summary, first = @parser.parse_result(detail)
 
  return {
      :state => state,
      :title => @runner.name,
      :summary => summary,
      :first => first,
      :detail => detail
    }
end