@@ -9,6 +9,7 @@ module RSpec
99 # and attempts to ballence the jobs accordingly.
1010 class JobBuilder
1111 extend Forwardable
12+
1213 attr_reader :args , :workers , :configuration
1314
1415 def_delegators (
@@ -54,12 +55,12 @@ def timed_and_untimed_files(seconds_per_file)
5455 files_to_run
5556 . map ( &method ( :normalize_path ) )
5657 . reduce ( [ [ ] , [ ] ] ) do |( timed , untimed ) , file |
57- if ( time = seconds_per_file [ file ] )
58- [ timed + [ [ file , time ] ] , untimed ]
59- else
60- [ timed , untimed + [ file ] ]
58+ if ( time = seconds_per_file [ file ] )
59+ [ timed + [ [ file , time ] ] , untimed ]
60+ else
61+ [ timed , untimed + [ file ] ]
62+ end
6163 end
62- end
6364 end
6465
6566 def normalize_path ( path )
@@ -73,14 +74,15 @@ def load_persisted_example_statuses
7374 end
7475
7576 def sum_seconds ( statuses )
76- statuses . select ( &passing )
77- . map { |example | parse_example ( **example ) }
78- . reduce ( { } ) do |times , example |
79- times . merge (
80- example . fetch ( :file_name ) => example . fetch ( :seconds )
81- ) do |_ , old = 0 , new |
82- old + new
83- end
77+ statuses
78+ . select ( &passing )
79+ . map { |example | parse_example ( **example ) }
80+ . reduce ( { } ) do |times , example |
81+ times . merge (
82+ example . fetch ( :file_name ) => example . fetch ( :seconds )
83+ ) do |_ , old = 0 , new |
84+ old + new
85+ end
8486 end
8587 end
8688
@@ -109,10 +111,10 @@ def balance_by(count, items, &block)
109111 . sort_by ( &block )
110112 . reverse
111113 . each do |entry |
112- groups . min_by do |group |
113- group . map ( &block ) . reduce ( :+ ) || 0
114- end . push ( entry )
115- end
114+ groups . min_by do |group |
115+ group . map ( &block ) . reduce ( :+ ) || 0
116+ end . push ( entry )
117+ end
116118 end
117119 end
118120 end
0 commit comments