Class: Gem::Tasks::Push
- Defined in:
- lib/rubygems/tasks/push.rb
Overview
The push task.
Constant Summary
Constants included from Printing
Gem::Tasks::Printing::ANSI_BRIGHT, Gem::Tasks::Printing::ANSI_CLEAR, Gem::Tasks::Printing::ANSI_GREEN, Gem::Tasks::Printing::ANSI_RED, Gem::Tasks::Printing::ANSI_YELLOW, Gem::Tasks::Printing::DEBUG_PREFIX, Gem::Tasks::Printing::ERROR_PREFIX, Gem::Tasks::Printing::STATUS_PREFIX
Instance Attribute Summary collapse
-
#host ⇒ String?
The rubygems host to push gems to.
-
#key ⇒ String?
The rubygems API key.
Attributes inherited from Task
Instance Method Summary collapse
-
#define ⇒ Object
Defines the
pushtask. -
#initialize(host: nil, key: nil) {|_self| ... } ⇒ Push
constructor
Initializes the
pushtask. -
#push(path) ⇒ Boolean
Pushes the gem by running
gem push.
Methods inherited from Task
#bundle, #gem, #gemspec_tasks, #invoke, #namespaced_tasks, #run, #task?
Methods included from Printing
Constructor Details
#initialize(host: nil, key: nil) {|_self| ... } ⇒ Push
Initializes the push task.
33 34 35 36 37 38 39 40 41 |
# File 'lib/rubygems/tasks/push.rb', line 33 def initialize(host: nil, key: nil) super() @host = host @key = key yield self if block_given? define end |
Instance Attribute Details
#host ⇒ String?
The rubygems host to push gems to.
15 16 17 |
# File 'lib/rubygems/tasks/push.rb', line 15 def host @host end |
#key ⇒ String?
The rubygems API key.
22 23 24 |
# File 'lib/rubygems/tasks/push.rb', line 22 def key @key end |
Instance Method Details
#define ⇒ Object
Defines the push task.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/rubygems/tasks/push.rb', line 46 def define task :validate namespace :push do @project.builds.each do |build,packages| path = packages[:gem] task build => [:validate, path] do if @host status "Pushing #{File.basename(path)} to #{@host} ..." else status "Pushing #{File.basename(path)} ..." end push(path) end end end gemspec_tasks :push # backwards compatibility for Hoe task :publish => :push end |
#push(path) ⇒ Boolean
Pushes the gem by running gem push.
82 83 84 85 86 87 88 |
# File 'lib/rubygems/tasks/push.rb', line 82 def push(path) arguments = ['gem', 'push', path] arguments.push('--key', @key) if @key arguments.push('--host', @host) if @host return run(*arguments) end |