Sha256: 4cf63365d5bce40e1acc8364ae1f2f2b9385596a9270376ce470d56703ae77c1

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require 'rubygems/tasks/task'

module Gem
  class Tasks
    module SCM
      #
      # The `scm:push` task.
      #
      class Push < Task

        #
        # Initializes the `scm:push` task.
        #
        # @param [Hash] options
        #   Additional options.
        #
        def initialize(options={})
          super()

          yield self if block_given?
          define
        end

        #
        # Defines the `scm:push` task.
        #
        def define
          namespace :scm do
            task :push do
              status "Pushing commits ..."

              unless push!
                error "Could not push commits"
              end
            end
          end
        end

        #
        # Pushes commits.
        #
        # @return [Boolean]
        #   Specifies whether the commits were successfully pushed.
        #
        def push!
          case @project.scm
          when :git then run 'git', 'push', '--tags'
          when :hg  then run 'hg', 'push'
          else           true
          end
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubygems-tasks-0.1.1 lib/rubygems/tasks/scm/push.rb
rubygems-tasks-0.1.0 lib/rubygems/tasks/scm/push.rb
rubygems-tasks-0.1.0.pre3 lib/rubygems/tasks/scm/push.rb
rubygems-tasks-0.1.0.pre2 lib/rubygems/tasks/scm/push.rb
rubygems-tasks-0.1.0.pre1 lib/rubygems/tasks/scm/push.rb