Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Pass --host and --key opts to gem release command on to the gem push command #16

Merged
merged 2 commits into from

2 participants

@jacobo

as requested in: #15

@jacobo

Hold up, that doesn't exactly work in practice.... figuring out why

@jacobo jacobo opt parse happens twice with opts passed through to PushCommand, ther…
…efore values for such args must always be captured as strings
2eaee75
@jacobo

There we go. How do you feel about this one? @dgeb + @svenfuchs

@dgeb dgeb merged commit 025498a into svenfuchs:master
@dgeb
Collaborator

Thanks @jacobo - merged. I'm also going to incorporate these options into bump (for use with -r) before releasing a new version.

@jacobo

thanks @dgeb, looking forward to a new release so we can start using these new flags!

@dgeb
Collaborator

@jacobo You bet. I just started, but I will try to wrap up the next release this weekend.

@dgeb
Collaborator

@jacobo I've pushed gem-release 0.2.0, which contains the new flags. Thanks again for your PR.

I had to change course with gem bump because I uncovered issue #17 as I was filling out some tests for releasing and bumping gems in the same command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 8, 2012
  1. @jacobo
  2. @jacobo

    opt parse happens twice with opts passed through to PushCommand, ther…

    jacobo authored
    …efore values for such args must always be captured as strings
This page is out of date. Refresh to see the latest.
View
7 lib/rubygems/commands/release_command.rb
@@ -15,9 +15,14 @@ class Gem::Commands::ReleaseCommand < Gem::Command
def initialize(options = {})
super 'release', 'Build gem from a gemspec and push to rubygems.org', DEFAULTS.merge(options)
+ @pushargs = []
option :tag, '-t', 'Create a git tag and push --tags to origin'
option :quiet, '-q', 'Do not output status messages'
+ add_option('-k', '--key KEYNAME',
+ 'Use the given API key from ~/.gem/credentials'){ |value, _| @pushargs += ["--key", value] }
+ add_option('-h', '--host HOST',
+ 'Push to another gemcutter-compatible host'){ |value, _| @pushargs += ["--host", value] }
@arguments = "gemspec - optional gemspec file name, will use the first *.gemspec if not specified"
@usage = "#{program_name} [gemspec]"
@@ -41,7 +46,7 @@ def build
end
def push
- PushCommand.new.invoke(gem_filename)
+ PushCommand.new.invoke(gem_filename, *@pushargs)
end
def remove
View
11 test/release_command_test.rb
@@ -33,4 +33,15 @@ def setup
TagCommand.new.expects(:execute)
ReleaseCommand.new.invoke('--tag')
end
+
+ test "passes --key args to the push command" do
+ PushCommand.new.expects(:invoke).with("gem-release-0.0.1.gem", "--key", "engineyard")
+ ReleaseCommand.new.invoke('--key', 'engineyard')
+ end
+
+ test "passes --host args to the push command" do
+ PushCommand.new.expects(:invoke).with("gem-release-0.0.1.gem", "--host", "http://rubygems.engineyard.com")
+ ReleaseCommand.new.invoke('--host', 'http://rubygems.engineyard.com')
+ end
+
end
Something went wrong with that request. Please try again.