lib/advance.rb in advance-0.4.8 vs lib/advance.rb in advance-0.4.10
- old
+ new
@@ -238,11 +238,11 @@
command.gsub!("{file_name_without_extension}", root_file_name)
puts "#{YELLOW}#{command}#{RESET} " if env_is?("ADVANCE_VERBOSE_LOGGING", false)
work_in_sub_dir(new_dir_name) do
do_command command, env_is?("ADVANCE_VERBOSE_LOGGING", false)
end
- do_command_wo_log "rm #{file_path}" if !env_is?("ADVANCE_SAVE_HISTORY", true)
+ do_command_wo_log("rm #{file_path}", false) if !env_is?("ADVANCE_SAVE_HISTORY", true)
rescue
puts "%%%% error while processing >>#{file_path}<<"
raise
end
end
@@ -311,19 +311,23 @@
def do_command(command, feedback = true)
puts "#{YELLOW}#{command}#{RESET} " if feedback
start_time = Time.now
stdout, stderr, status = Open3.capture3(command)
- elapsed_time = Time.now - start_time
- File.open("log", "w") do |f|
- f.puts "%%% command: >#{command}<"
- f.puts "%%% returned status: >#{status}<"
- f.puts "%%% elapsed time: #{elapsed_time} seconds"
- f.puts "%%% stdout:"
- f.puts stdout
- f.puts "%%% stderr:"
- f.puts stderr
+
+ if env_is?("ADVANCE_LOG_FILES", true)
+ elapsed_time = Time.now - start_time
+ File.open("log", "w") do |f|
+ f.puts "%%% command: >#{command}<"
+ f.puts "%%% returned status: >#{status}<"
+ f.puts "%%% elapsed time: #{elapsed_time} seconds"
+ f.puts "%%% stdout:"
+ f.puts stdout
+ f.puts "%%% stderr:"
+ f.puts stderr
+ end
end
+
if !status.success?
raise "step #{$step} failed with #{status}\n#{stderr}"
end
end