lib/autoproj/package_managers/bundler_manager.rb in autoproj-2.4.0 vs lib/autoproj/package_managers/bundler_manager.rb in autoproj-2.5.0.pre1

- old
+ new

@@ -80,11 +80,11 @@ prefix_gems = File.join(ws.prefix_dir, "gems") FileUtils.mkdir_p prefix_gems gemfile = File.join(prefix_gems, 'Gemfile') if !File.exist?(gemfile) - File.open(gemfile, 'w') do |io| + Ops.atomic_write(gemfile) do |io| io.puts "eval_gemfile \"#{File.join(ws.dot_autoproj_dir, 'Gemfile')}\"" end end if bundle_rubylib = discover_bundle_rubylib(silent_errors: true) @@ -312,11 +312,11 @@ # Back up the existing gemfile, we'll restore it if something is # wrong to avoid leaving bundler in an inconsistent state backup_files(backups) if !File.file?("#{gemfile_path}.orig") - File.open("#{gemfile_path}.orig", 'w') do |io| + Ops.atomic_write("#{gemfile_path}.orig") do |io| io.puts "eval_gemfile \"#{File.join(ws.dot_autoproj_dir, 'Gemfile')}\"" end end gemfiles = workspace_configuration_gemfiles @@ -336,10 +336,10 @@ merge_gemfiles(*gemfiles) end FileUtils.mkdir_p root_dir if updated = (!File.exist?(gemfile_path) || File.read(gemfile_path) != gemfile_contents) - File.open(gemfile_path, 'w') do |io| + Ops.atomic_write(gemfile_path) do |io| io.puts "ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)" io.puts gemfile_contents end end