class Gem::Tasks::SCM::Push

The `scm:push` task.

Public Class Methods

new(options={}) { |self| ... } click to toggle source

Initializes the `scm:push` task.

@param [Hash] options

Additional options.
Calls superclass method
# File lib/rubygems/tasks/scm/push.rb, line 17
def initialize(options={})
  super()

  yield self if block_given?
  define
end

Public Instance Methods

define() click to toggle source

Defines the `scm:push` task.

# File lib/rubygems/tasks/scm/push.rb, line 27
def define
  task :validate

  namespace :scm do
    task :push => :validate do
      status "Pushing commits ..."

      unless push!
        error "Could not push commits"
      end
    end
  end
end
push!() click to toggle source

Pushes commits.

@return [Boolean]

Specifies whether the commits were successfully pushed.

@api semipublic

# File lib/rubygems/tasks/scm/push.rb, line 49
def push!
  case @project.scm
  when :git
    run 'git', 'push'
    run 'git', 'push', '--tags'
  when :hg 
    run 'hg', 'push'
  else
    true
  end
end