Class: TestBoosters::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/test_boosters/job.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, known_files, leftover_files) ⇒ Job

Returns a new instance of Job.



8
9
10
11
12
# File 'lib/test_boosters/job.rb', line 8

def initialize(command, known_files, leftover_files)
  @command = command
  @known_files = known_files
  @leftover_files = leftover_files
end

Class Method Details

.run(command, known_files, leftover_files) ⇒ Object



4
5
6
# File 'lib/test_boosters/job.rb', line 4

def self.run(command, known_files, leftover_files)
  new(command, known_files, leftover_files).run
end

Instance Method Details

#display_headerObject



14
15
16
17
18
19
20
21
# File 'lib/test_boosters/job.rb', line 14

def display_header
  puts
  TestBoosters::Shell.display_files("Known files for this job", @known_files)
  TestBoosters::Shell.display_files("Leftover files for this job", @leftover_files)

  puts "=" * 80
  puts ""
end

#filesObject



23
24
25
# File 'lib/test_boosters/job.rb', line 23

def files
  @all_files ||= @known_files + @leftover_files
end

#runObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/test_boosters/job.rb', line 27

def run
  display_header

  if files.empty?
    puts("No files to run in this job!")

    return 0
  end

  TestBoosters::Shell.execute("#{@command} #{files.join(" ")}")
end