diff options
author | The Bundler Bot <bot@bundler.io> | 2017-06-01 03:48:39 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-06-01 03:48:39 +0000 |
commit | dfbe1256f6fb1af6fb7ee866fecb809106dafcb6 (patch) | |
tree | 79165e9182f0fc22a785c37d58864cfb68b769c7 | |
parent | 765729c57112d9a7d0b1813a56525f76bf2b1175 (diff) | |
parent | 2803c9a5795315ac1d8579bf202c2f6f6a97a11f (diff) | |
download | bundler-dfbe1256f6fb1af6fb7ee866fecb809106dafcb6.tar.gz |
Auto merge of #5695 - mdeering:master, r=segiddins
List the remote host correctly in rake task desc.
When using the `allowed_push_host` metadata in a gems gemspec along with `bundler/gem_tasks` `rake release` shows that the gem will be pushed to rubygems.org rather then showing the configured `allowed_push_host` if that has been set. This resolves that confusion by showing the correct host that `rake release` will attempt to push to.
* [x] `bin/rspec`
* [x] `rubocop -a`
-rw-r--r-- | lib/bundler/gem_helper.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 3c1680a194..6a0906a200 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -50,7 +50,7 @@ module Bundler install_gem(built_gem_path, :local) end - desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to RubyGems\n" \ + desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to #{gem_push_host}\n" \ "To prevent publishing in RubyGems use `gem_push=no rake release`" task "release", [:remote] => ["build", "release:guard_clean", "release:source_control_push", "release:rubygem_push"] do @@ -92,18 +92,14 @@ module Bundler protected def rubygem_push(path) - allowed_push_host = nil gem_command = "gem push '#{path}'" gem_command += " --key #{gem_key}" if gem_key - if @gemspec.respond_to?(:metadata) - allowed_push_host = @gemspec.metadata["allowed_push_host"] - gem_command += " --host #{allowed_push_host}" if allowed_push_host - end + gem_command += " --host #{allowed_push_host}" if allowed_push_host unless allowed_push_host || Bundler.user_home.join(".gem/credentials").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."}" + Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}" end def built_gem_path @@ -116,6 +112,14 @@ module Bundler Bundler.ui.confirm "Pushed git commits and tags." end + def allowed_push_host + @gemspec.metadata["allowed_push_host"] if @gemspec.respond_to?(:metadata) + end + + def gem_push_host + allowed_push_host || "rubygems.org" + end + def perform_git_push(options = "") cmd = "git push #{options}" out, code = sh_with_code(cmd) |