diff options
author | The Bundler Bot <bot@bundler.io> | 2017-03-16 14:41:42 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-03-16 14:41:42 +0000 |
commit | 81d53b52444572cf1454da4c741242e2dd47de5c (patch) | |
tree | 474414fdcae9e77fcd6086299a459591e4b4561c | |
parent | 2e127e90873299f24517b5bec6d9890c452ae7cb (diff) | |
parent | 817988bcb4f5e1a920aeb1c4fdb6395c746e2b6c (diff) | |
download | bundler-81d53b52444572cf1454da4c741242e2dd47de5c.tar.gz |
Auto merge of #5428 - DTrierweiler:master, r=segiddins
Adding the --key option for releasing private gems with gemstash
In order to use the `rake release` command with a private gemstash server, I'd need the `--key` option described here:
https://github.com/bundler/gemstash/blob/master/docs/gemstash-private-gems.7.md#pushing
I added a quite unobtrusive method to check for an ENV variable and - if it's present - add the `--key` param.
Final command would be:
`GEM_KEY=test_key bundle exec rake release`
-rw-r--r-- | lib/bundler/gem_helper.rb | 5 | ||||
-rw-r--r-- | man/bundle-config.ronn | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 73cbf9e0d1..936d1361fa 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -94,6 +94,7 @@ module Bundler 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 @@ -181,6 +182,10 @@ module Bundler end end + def gem_key + Bundler.settings["gem.push_key"].to_s.downcase if Bundler.settings["gem.push_key"] + end + def gem_push? !%w(n no nil false off 0).include?(ENV["gem_push"].to_s.downcase) end diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn index fbfe9c971b..926adcbb09 100644 --- a/man/bundle-config.ronn +++ b/man/bundle-config.ronn @@ -219,6 +219,9 @@ learn more about their operation in [bundle install(1)][bundle-install]. The location where RubyGems installs binstubs. Defaults to `Gem.bindir`. * `user_agent` (`BUNDLE_USER_AGENT`): The custom user agent fragment Bundler includes in API requests. +* `gem.push_key` (`BUNDLE_GEM__PUSH_KEY`): + Sets the `--key` paramter for `gem push` when using the `rake release` + command with a private gemstash server. In general, you should set these settings per-application by using the applicable flag to the [bundle install(1)][bundle-install] or [bundle package(1)][bundle-package] command. |