lib/rspeed/splitter.rb in rspeed-0.6.0 vs lib/rspeed/splitter.rb in rspeed-0.7.0
- old
+ new
@@ -29,23 +29,25 @@
end
def pipe_files
return unless RSpeed::Redis.result?
- splitted = split(data: RSpeed::Differ.diff)
+ splitted = split(data: RSpeed::Differ.diff[:actual_files])
- splitted[RSpeed::Variable.key(RSpeed::Env.pipe)][:files].map { |item| item[:file] }.join(' ')
+ splitted[RSpeed::Variable.key(RSpeed::Env.pipe)][:files].tap do |items|
+ RSpeed::Reporter.print_files(items)
+ end.map { |item| item[:file] }.join(' ')
end
def split(data:)
json = {}
RSpeed::Env.pipes.times do |index|
json[RSpeed::Variable.key(index + 1)] ||= []
json[RSpeed::Variable.key(index + 1)] = { total: 0, files: [], number: index + 1 }
end
- sorted_data = data.sort_by { |item| item[:time] }.reverse
+ sorted_data = data.sort_by { |item| item[:time] || 0.0 }.reverse
sorted_data.each do |record|
selected_pipe_data = json.min_by { |pipe| pipe[1][:total] }
selected_pipe = json[RSpeed::Variable.key(selected_pipe_data[1][:number])]
time = record[:time].to_f