lib/bundler/cli/gem.rb in bundler-1.14.3 vs lib/bundler/cli/gem.rb in bundler-1.14.4
- old
+ new
@@ -120,11 +120,14 @@
"ext/newgem/newgem.c.tt" => "ext/#{name}/#{underscored_name}.c"
)
end
templates.each do |src, dst|
- thor.template("newgem/#{src}", target.join(dst), config)
+ destination = target.join(dst)
+ SharedHelpers.filesystem_access(destination) do
+ thor.template("newgem/#{src}", destination, config)
+ end
end
executables.each do |file|
path = target.join(file)
executable = (path.stat.mode | 0o111)
@@ -137,9 +140,11 @@
`git add .`
end
# Open gemspec in editor
open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
+ rescue Errno::EEXIST => e
+ raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
end
private
def resolve_name(name)