Class: Gem::Commands::CoopCommand

Inherits:
Gem::Command
  • Object
show all
Defined in:
lib/rubygems_plugin.rb

Instance Method Summary collapse

Constructor Details

#initializeCoopCommand

Returns a new instance of CoopCommand.



8
9
10
# File 'lib/rubygems_plugin.rb', line 8

def initialize
  super "coop", "Commands to interact with gem.coop"
end

Instance Method Details

#executeObject

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
# File 'lib/rubygems_plugin.rb', line 21

def execute
  case subcommand
  when "release-dev" then release_dev
  when "release" then release
  when "push" then push(package_path: @args.first)
  else
    puts "USAGE: gem coop COMMAND"
    puts ""
    puts "Commands:"
    puts "  push @NAME PATH    # Push a pre-built gem to your namespace (#{@host}/@name)"
    puts "  release @NAME      # Build and push to your namespace (#{@host}/@name)"
    puts "  release-dev @NAME  # Build and push to your dev index (#{@host}/@name/dev)"
  end
end

#handle_options(args) ⇒ Object



12
13
14
15
16
17
# File 'lib/rubygems_plugin.rb', line 12

def handle_options(args)
  @host = ENV.fetch("GEM_HOST", "gem.coop")
  @subcommand = args.shift
  @namespace = args.shift
  @args = args # Sidestep Gem::Command option parsing
end