summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/init.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/cli/init.rb')
-rw-r--r--lib/bundler/cli/init.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb
index e4f8229c48..246b9d6460 100644
--- a/lib/bundler/cli/init.rb
+++ b/lib/bundler/cli/init.rb
@@ -32,7 +32,11 @@ module Bundler
file << spec.to_gemfile
end
else
- FileUtils.cp(File.expand_path("../templates/#{gemfile}", __dir__), gemfile)
+ File.open(File.expand_path("../templates/Gemfile", __dir__), "r") do |template|
+ File.open(gemfile, "wb") do |destination|
+ IO.copy_stream(template, destination)
+ end
+ end
end
puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}"
@@ -41,7 +45,7 @@ module Bundler
private
def gemfile
- @gemfile ||= Bundler.preferred_gemfile_name
+ @gemfile ||= options[:gemfile] || Bundler.preferred_gemfile_name
end
end
end