diff options
author | Homu <homu@barosl.com> | 2015-08-30 08:40:38 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2015-08-30 08:40:38 +0900 |
commit | 6963b80fb1772b664069421cdbe3ae1e548ccef0 (patch) | |
tree | 09c307ce0949e0f09604dfe215288e9206bd4e59 | |
parent | c936424dee18a5222eeb2e3bc6d56366fe326a4a (diff) | |
parent | 465a6377f2795df397c43c51db7e095305b2922d (diff) | |
download | bundler-6963b80fb1772b664069421cdbe3ae1e548ccef0.tar.gz |
Auto merge of #3968 - pmenglund:gem_push_host, r=indirect
make it able to specify gem host with GEM_HOST env
when you in your `.gemspec` specify
```
if spec.respond_to?(:metadata)
spec.metadata['allowed_push_host'] = 'https://gems.example.com'
end
```
you can't use the `bundler` rake tasks, as it can't specify the alternate host. This change picks up the `allowed_push_host` and uses it when pushing.
-rw-r--r-- | lib/bundler/gem_helper.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index ab7bcc27a0..ba1323356a 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -92,8 +92,14 @@ module Bundler def rubygem_push(path) if Pathname.new("~/.gem/credentials").expand_path.exist? - sh("gem push '#{path}'") - Bundler.ui.confirm "Pushed #{name} #{version} to rubygems.org." + allowed_push_host = nil + gem_command = "gem push '#{path}'" + 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 raise "Your rubygems.org credentials aren't set. Run `gem push` to set them." end |