Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gather-test-memory-data « scripts - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3156365ac199faae893a85f1aac642e586815827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'csv'

def join_csv_files(output_path, input_paths)
  return if input_paths.empty?

  input_csvs = input_paths.map do |input_path|
    CSV.read(input_path, headers: true)
  end

  CSV.open(output_path, "w", headers: input_csvs.first.headers, write_headers: true) do |output_csv|
    input_csvs.each do |input_csv|
      input_csv.each do |line|
        output_csv << line
      end
    end
  end
end

join_csv_files('tmp/memory_test/report.csv', Dir['tmp/memory_test/*.csv'].sort)