Class: GemPublisher::Pusher

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_publisher/pusher.rb

Constant Summary collapse

PUSH_METHODS =
{
  "rubygems" => %w[gem push],
  "gemfury"  => %w[fury push]
}

Instance Method Summary collapse

Constructor Details

#initialize(cli_facade = CliFacade.new) ⇒ Pusher

Returns a new instance of Pusher.



5
6
7
# File 'lib/gem_publisher/pusher.rb', line 5

def initialize(cli_facade = CliFacade.new)
  @cli_facade = cli_facade
end

Instance Method Details

#push(gem, method, options = {}) ⇒ Object

Publish the gem.

Supported options:

:as - specify a shared account to publish the gem (Gemfury only)


18
19
20
21
22
23
# File 'lib/gem_publisher/pusher.rb', line 18

def push(gem, method, options = {})
  push_command = PUSH_METHODS[method.to_s] or raise "Unknown Gem push method #{method.inspect}."
  push_command += [gem]
  push_command += ["--as", options[:as]] if options[:as]
  @cli_facade.execute *push_command
end