Class: FastRake::FastRunner
- Inherits:
-
Object
- Object
- FastRake::FastRunner
- Defined in:
- lib/fast_rake/fast_runner.rb
Constant Summary collapse
- GREEN =
"\033[32m"
- RED =
sets inverse text (white on red) to make it stand out more
"\033[31;7m"
- YELLOW =
"\e[33m"
- RESET =
"\033[0m"
Instance Method Summary collapse
-
#initialize(tasks, process_count, fail_fast) ⇒ FastRunner
constructor
A new instance of FastRunner.
- #run ⇒ Object
Constructor Details
#initialize(tasks, process_count, fail_fast) ⇒ FastRunner
Returns a new instance of FastRunner.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fast_rake/fast_runner.rb', line 11 def initialize(tasks, process_count, fail_fast) @tasks = tasks @process_count = process_count @fail_fast = fail_fast @children = {} @parent = true @env_number = 0 @failed=false @failed_tasks=[] #put_w_time "Parent PID is: #{Process.pid}" end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fast_rake/fast_runner.rb', line 23 def run clean_previous_results @start = Time.now put_w_time %{Started at #{Time.now.strftime("%H:%M:%S")}, (will run #{@process_count} parallel processes)} at_exit { kill_remaining_children } start_some_children wait_for_tasks_to_finish put_w_time "#{@failed ? RED : GREEN}Elapsed time: #{distance_of_time_to_now(@start)}#{RESET}" if @failed if @fail_fast raise 'failed fast' else puts_failed raise 'failed after all' end end end |