fast_rake 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/fast_rake/fast_runner.rb +24 -6
- data/lib/fast_rake/version.rb +2 -2
- data/lib/fast_rake.rb +6 -6
- metadata +4 -4
@@ -8,13 +8,15 @@ class FastRake::FastRunner
|
|
8
8
|
YELLOW = "\e[33m"
|
9
9
|
RESET = "\033[0m"
|
10
10
|
|
11
|
-
def initialize(tasks, process_count)
|
11
|
+
def initialize(tasks, process_count, fail_fast)
|
12
12
|
@tasks = tasks
|
13
13
|
@process_count = process_count
|
14
|
+
@fail_fast = fail_fast
|
14
15
|
@children = {}
|
15
16
|
@parent = true
|
16
17
|
@env_number = 0
|
17
18
|
@failed=false
|
19
|
+
@failed_tasks=[]
|
18
20
|
#put_w_time "Parent PID is: #{Process.pid}"
|
19
21
|
end
|
20
22
|
|
@@ -29,7 +31,14 @@ class FastRake::FastRunner
|
|
29
31
|
|
30
32
|
wait_for_tasks_to_finish
|
31
33
|
put_w_time "#{@failed ? RED : GREEN}Elapsed time: #{distance_of_time_to_now(@start)}#{RESET}"
|
32
|
-
|
34
|
+
if @failed
|
35
|
+
if @fail_fast
|
36
|
+
raise 'failed fast'
|
37
|
+
else
|
38
|
+
puts_failed
|
39
|
+
raise 'failed after all'
|
40
|
+
end
|
41
|
+
end
|
33
42
|
end
|
34
43
|
|
35
44
|
private
|
@@ -120,7 +129,11 @@ class FastRake::FastRunner
|
|
120
129
|
return if @children.length == 0
|
121
130
|
child_names = @children.values.collect { |v| v[:name] }
|
122
131
|
outstanding = [current_task[:name], child_names, @tasks].flatten
|
123
|
-
put_w_time "#{YELLOW}Rerun with: ['#{outstanding.join(' ')}']#{RESET}"
|
132
|
+
put_w_time "#{YELLOW}Rerun only the remaining tasks with: ['#{outstanding.join(' ')}']#{RESET}"
|
133
|
+
end
|
134
|
+
|
135
|
+
def puts_failed
|
136
|
+
put_w_time "#{YELLOW}Rerun only the failed tasks with: ['#{@failed_tasks.join(' ')}']#{RESET}"
|
124
137
|
end
|
125
138
|
|
126
139
|
def wait_for_task_with_timeout(pid, timeout=5)
|
@@ -148,13 +161,18 @@ class FastRake::FastRunner
|
|
148
161
|
put_w_time "#{GREEN}[#{task[:name]}] Output is in #{output_path}#{RESET}"
|
149
162
|
puts_still_running
|
150
163
|
start_some_children
|
151
|
-
|
164
|
+
elsif @fail_fast
|
152
165
|
if !@failed
|
153
|
-
put_w_time "#{RED}[#{task[:name]}] Build failed. Output
|
166
|
+
put_w_time "#{RED}[#{task[:name]}] Build failed. Output is in #{output_path}#{RESET}"
|
154
167
|
puts_rerun(task)
|
155
|
-
@failed=true
|
168
|
+
@failed = true
|
169
|
+
#killing the remaining children will also trigger this block
|
156
170
|
kill_remaining_children
|
157
171
|
end
|
172
|
+
elsif !@fail_fast
|
173
|
+
put_w_time "#{RED}[#{task[:name]}] Build failed. Output is in #{output_path}#{RESET}"
|
174
|
+
@failed_tasks << task[:name]
|
175
|
+
@failed = true
|
158
176
|
end
|
159
177
|
end
|
160
178
|
rescue Errno::ECHILD
|
data/lib/fast_rake/version.rb
CHANGED
data/lib/fast_rake.rb
CHANGED
@@ -4,13 +4,13 @@ require 'fast_rake/fast_runner'
|
|
4
4
|
module FastRake
|
5
5
|
extend Rake::DSL
|
6
6
|
|
7
|
-
def self.fast_runner(setup_tasks, run_tasks)
|
8
|
-
fast_runner_task(:two, 2, setup_tasks, run_tasks)
|
9
|
-
fast_runner_task(:four, 4, setup_tasks, run_tasks)
|
10
|
-
fast_runner_task(:eight, 8, setup_tasks, run_tasks)
|
7
|
+
def self.fast_runner(setup_tasks, run_tasks, fail_fast=true)
|
8
|
+
fast_runner_task(:two, 2, setup_tasks, run_tasks, fail_fast)
|
9
|
+
fast_runner_task(:four, 4, setup_tasks, run_tasks, fail_fast)
|
10
|
+
fast_runner_task(:eight, 8, setup_tasks, run_tasks, fail_fast)
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.fast_runner_task(name, processes, setup_tasks, run_tasks)
|
13
|
+
def self.fast_runner_task(name, processes, setup_tasks, run_tasks, fail_fast=true)
|
14
14
|
desc "Fast test runner for #{processes} cpus"
|
15
15
|
task name, [:list] => setup_tasks do |t, args|
|
16
16
|
tasks_to_run = if !args[:list].nil?
|
@@ -18,7 +18,7 @@ module FastRake
|
|
18
18
|
else
|
19
19
|
run_tasks
|
20
20
|
end
|
21
|
-
FastRunner.new(tasks_to_run, processes).run
|
21
|
+
FastRunner.new(tasks_to_run, processes, fail_fast).run
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.6
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonathan Ricketson
|
@@ -52,7 +52,7 @@ licenses: []
|
|
52
52
|
post_install_message:
|
53
53
|
rdoc_options:
|
54
54
|
- --title
|
55
|
-
- fast_rake-0.0
|
55
|
+
- fast_rake-0.1.0 Documentation
|
56
56
|
require_paths:
|
57
57
|
- lib
|
58
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|