summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/init.rb
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-06-01 07:42:05 +0000
committerSamuel Giddins <segiddins@segiddins.me>2017-06-01 23:55:32 -0500
commit388fde46c180c4e2b569329c9b962dea4ccc8671 (patch)
tree1e3dfef7549b1d0c0f61f156db958ab237ad851f /lib/bundler/cli/init.rb
parent3131fa36e2223010143a434c24779dd6e983e788 (diff)
downloadbundler-388fde46c180c4e2b569329c9b962dea4ccc8671.tar.gz
Auto merge of #5690 - bundler:colby/bundler-init-invalid-gemspec, r=segiddins
Fix `bundle init --gemspec` breaking when gemspec is invalid Also added some specs to init what wasn't being tested. (cherry picked from commit d2d669746bc4e7f55c50f730e5fc965874ab1161)
Diffstat (limited to 'lib/bundler/cli/init.rb')
-rw-r--r--lib/bundler/cli/init.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb
index 4bbdee1f48..8ffd1db41a 100644
--- a/lib/bundler/cli/init.rb
+++ b/lib/bundler/cli/init.rb
@@ -18,7 +18,9 @@ module Bundler
Bundler.ui.error "Gem specification #{gemspec} doesn't exist"
exit 1
end
- spec = Gem::Specification.load(gemspec)
+
+ spec = Bundler.load_gemspec_uncached(gemspec)
+
puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile"
File.open("Gemfile", "wb") do |file|
file << "# Generated from #{gemspec}\n"