diff options
author | Martin Englund <martin@englund.nu> | 2015-08-29 10:39:52 -0700 |
---|---|---|
committer | Martin Englund <martin@englund.nu> | 2015-08-29 10:39:52 -0700 |
commit | 465a6377f2795df397c43c51db7e095305b2922d (patch) | |
tree | 3e8406dcd1c09a587daa7b1e52e0fbca53a08dfd | |
parent | b9d6b815299a7662fa0385f47bac500b16fd4ddf (diff) | |
download | bundler-465a6377f2795df397c43c51db7e095305b2922d.tar.gz |
guard against old gemspec
-rw-r--r-- | lib/bundler/gem_helper.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 3f80847c63..ba1323356a 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -92,9 +92,12 @@ module Bundler def rubygem_push(path) if Pathname.new("~/.gem/credentials").expand_path.exist? + allowed_push_host = nil gem_command = "gem push '#{path}'" - allowed_push_host = @gemspec.metadata["allowed_push_host"] - gem_command << " --host #{allowed_push_host}" if allowed_push_host + if spec.respond_to?(:metadata) + allowed_push_host = @gemspec.metadata["allowed_push_host"] + gem_command << " --host #{allowed_push_host}" if allowed_push_host + end sh(gem_command) Bundler.ui.confirm "Pushed #{name} #{version} to #{allowed_push_host ? allowed_push_host : "rubygems.org."}" else |