summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-05-16 04:38:54 +0900
committerSamuel Giddins <segiddins@segiddins.me>2016-05-16 15:35:57 -0500
commit5d1dab00d9335fd336a19746f31b0368b4207b4b (patch)
tree01e5fd6767d3c29da0a2599ee676a5303f4551ca
parent4974c4c806842c56856a90061875d4b8a17263e4 (diff)
downloadbundler-5d1dab00d9335fd336a19746f31b0368b4207b4b.tar.gz
Auto merge of #4446 - Cohen-Carlisle:non-rubygem-push, r=segiddins
don't error on missing rubygem cred if custom host only raise error asking user to set rubygem credentials during gem push if `allowed_push_host` is not set. Fixes https://github.com/bundler/bundler/issues/4437 Apologies if this is a half baked PR. - I looked around to add tests for this, but there is little test coverage over this area I simply wasn't sure how to add a test around this particular change. - I also wasn't sure where to put this in the `CHANGELOG` as the latest entry there is already released.
-rw-r--r--lib/bundler/gem_helper.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 41c574bfd2..a38136c36d 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -92,15 +92,15 @@ module Bundler
protected
def rubygem_push(path)
- unless Pathname.new("~/.gem/credentials").expand_path.file?
- raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
- end
allowed_push_host = nil
gem_command = "gem push '#{path}'"
if @gemspec.respond_to?(:metadata)
allowed_push_host = @gemspec.metadata["allowed_push_host"]
gem_command += " --host #{allowed_push_host}" if allowed_push_host
end
+ unless allowed_push_host || Pathname.new("~/.gem/credentials").expand_path.file?
+ raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
+ end
sh(gem_command)
Bundler.ui.confirm "Pushed #{name} #{version} to #{allowed_push_host ? allowed_push_host : "rubygems.org."}"
end