lib/advance.rb in advance-0.3.13 vs lib/advance.rb in advance-0.3.14
- old
+ new
@@ -1,5 +1,6 @@
+require "csv"
require "fileutils"
require "find"
require "json"
require "open3"
require "team_effort"
@@ -69,9 +70,22 @@
}
meta["runs"][$run_number] ||= []
meta["runs"][$run_number] << step_data
File.write(".meta", JSON.pretty_generate(meta))
+ end
+
+ def capture_column_names_from_csv
+ if $step.nil?
+ raise "capture_column_names_from_csv cannot be the first step"
+ end
+
+ previous_dir_path = get_previous_dir_path
+ input_file_path = previous_file_path(previous_dir_path)
+ CSV.foreach(input_file_path, :headers => true) do |row|
+ $column_names = row.headers
+ break
+ end
end
def advance(processing_mode, label, command)
$redo_mode ||= :checking
$step ||= 0