Class: Gem::Commands::CoopCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::CoopCommand
- Defined in:
- lib/gem/commands/coop_command.rb
Instance Method Summary collapse
-
#execute ⇒ Object
gem coop release @namespace –platform darwin21 # Calls ‘gem build`s then `gem push` gem coop push @namespace peak-0.1.0.gem # Wraps `gem push`.
- #handle_options(args) ⇒ Object
-
#initialize ⇒ CoopCommand
constructor
A new instance of CoopCommand.
Constructor Details
#initialize ⇒ CoopCommand
Returns a new instance of CoopCommand.
8 9 10 |
# File 'lib/gem/commands/coop_command.rb', line 8 def initialize super("coop", "Commands to interact with gem.coop") end |
Instance Method Details
#execute ⇒ Object
gem coop release @namespace –platform darwin21 # Calls ‘gem build`s then `gem push` gem coop push @namespace peak-0.1.0.gem # Wraps `gem push`
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gem/commands/coop_command.rb', line 21 def execute case subcommand when "release" then release when "build" then build when "push" then push(package_path: @args.first) else say "USAGE: gem coop COMMAND" say "" say "Passing --dev creates a development build of your gem: `<name>.<sha>.<year>.<month>.<day>.gem`" say "" say "" say "Commands:" say " release @NAME [--dev] # Build and push to (#{@host}/@name)" say " build @NAME [--dev] # Build a gemspec" say " push @NAME PATH # Push a built gem to (#{@host}/@name)" say "" say "Examples:" say "" say " GEM_HOST_API_KEY= gem coop build # Build the current .gemspec to pkg/" say " GEM_HOST_API_KEY= gem coop build --dev # Create a dev-build of .gemspec in pkg/" say "" say " GEM_HOST_API_KEY= gem coop push @name pkg/name-1.0.0.gem # Push a pre-built gem to your namespace" say "" say " GEM_HOST_API_KEY= gem coop release @name # Build and push a gem to your namespace" say " GEM_HOST_API_KEY= gem coop release @name/beta # Build and push a separate /beta index" say " GEM_HOST_API_KEY= gem coop release @name/dev --dev # Build and push a dev build to a separate /dev index" end end |
#handle_options(args) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/gem/commands/coop_command.rb', line 12 def (args) @host = ENV.fetch("GEM_HOST", "gem.coop") @subcommand = args.shift @namespace = args.shift @args = args # Sidestep Gem::Command option parsing end |