lib/advance.rb in advance-0.3.4 vs lib/advance.rb in advance-0.3.7
- old
+ new
@@ -28,10 +28,12 @@
else
{}
end
last_run_number = meta["last_run_number"] ||= -1
$run_number = last_run_number + 1
+ $cores=`sysctl -n hw.ncpu`.to_i
+ puts "Multi steps will use #{$cores} cores"
end
def update_meta(step_number, processing_mode, label, command, start_time, duration, file_count)
meta =
if File.exist?(".meta")
@@ -151,11 +153,10 @@
def single(command, previous_dir_path, dir_name)
work_in_sub_dir(dir_name) do
input_file_path = previous_file_path(previous_dir_path)
basename = File.basename(input_file_path)
root_file_name = basename.gsub(%r(\.[^.]+$), '')
-
command.gsub!("{input_dir}", previous_dir_path)
command.gsub!("{input_file}", input_file_path)
command.gsub!("{file_name}", basename)
command.gsub!("{file_name_without_extension}", root_file_name)
@@ -198,17 +199,17 @@
end
end
def work_in_sub_dir(dir_name)
starting_dir = FileUtils.pwd
- stripped_dir_name = strip_extensions(dir_name)
+ stripped_dir_name = File.join(*(strip_extensions(dir_name).split("/").uniq))
if $redo_mode == :checking && Dir.exist?(stripped_dir_name)
return
end
$redo_mode = :replacing
- dirs = File.split(stripped_dir_name)
+ dirs = stripped_dir_name.split("/")
dirs[-1] = "tmp_#{dirs[-1]}"
tmp_dir = File.join(dirs)
FileUtils.rm_rf tmp_dir
FileUtils.mkdir_p tmp_dir
FileUtils.cd tmp_dir