libraries/deploy-context/helpers/command.rb in deploy-context-2.2.0.3.gec16643.4.g20d2d42.4.g17e8559.12.g831d0a8.4.gbb2ab14.12.g0bc028d vs libraries/deploy-context/helpers/command.rb in deploy-context-2.13.0

- old
+ new

@@ -19,22 +19,21 @@ def is_admin? Process::Sys.getuid != 0 end def temp_dir - @temp_dir = Dir.tmpdir() if @temp_dir.nil? - @temp_dir + File.join(context_folder, 'results') end - def get_data(command_line) + def get_shell_data(command_line) debug_log "Get data from command #{command_line.join(' ')}" `#{command_line.join(' ')}` end def execute_command(command) command_status = system(command.join(' ')) - debug_log "executed command #{command.join(' ')}" + log "executed command #{command.join(' ')}" command_status end def sudo_command(command) if ! Gem.win_platform? && Process::Sys.getuid != 0 @@ -47,8 +46,12 @@ def write_in_system_file(file, content) debug_log "write_in_system_file #{[file, content]}" system("touch #{file}") ::File.write(file, content) system("chmod 644 #{file}") unless Gem.win_platform? + end + + def delete_file_only_if_exist(file) + FileUtils.rm file if File.exist? file end end end