summaryrefslogtreecommitdiff
path: root/lib/bundler/gem_helper.rb
diff options
context:
space:
mode:
authorCohen Carlisle <cohen.carlisle@gmail.com>2016-04-15 21:48:00 -0400
committerCohen Carlisle <cohen.carlisle@gmail.com>2016-04-15 21:48:00 -0400
commitc0690f960bfe9e6a2a5cee5d0d5ebf3282ec958d (patch)
tree2718fe705086743734691eb23919d1c5df17c290 /lib/bundler/gem_helper.rb
parentf401c17292c67b94b0f15a8c40af528fbb243f37 (diff)
downloadbundler-c0690f960bfe9e6a2a5cee5d0d5ebf3282ec958d.tar.gz
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.
Diffstat (limited to 'lib/bundler/gem_helper.rb')
-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