diff options
author | Colby Swandale <colby@taplaboratories.com> | 2017-05-31 23:35:38 +1000 |
---|---|---|
committer | Colby Swandale <colby@taplaboratories.com> | 2017-06-01 01:01:43 +1000 |
commit | fab4838fa2680d32f3591e00ac97677d8382a517 (patch) | |
tree | 7daae22dc7598af9fabd2be8ea9f623d6139da92 /lib | |
parent | bf26b5515926c51008f2fe9e9d0054260d482e74 (diff) | |
download | bundler-fab4838fa2680d32f3591e00ac97677d8382a517.tar.gz |
handle invalid gemspec and add specs for untested behaviour in bundle init --gemspec
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/cli/init.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb index 4bbdee1f48..774736f708 100644 --- a/lib/bundler/cli/init.rb +++ b/lib/bundler/cli/init.rb @@ -18,7 +18,13 @@ module Bundler Bundler.ui.error "Gem specification #{gemspec} doesn't exist" exit 1 end + spec = Gem::Specification.load(gemspec) + unless spec + Bundler.ui.error "Gem specification #{gemspec} is invalid" + exit 1 + end + puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile" File.open("Gemfile", "wb") do |file| file << "# Generated from #{gemspec}\n" |