Sha256: d03504e0c97072ca044abf5258f0debe1c4578d10e7585d15717cbaaffafc30c

Contents?: true

Size: 900 Bytes

Versions: 6

Compression:

Stored size: 900 Bytes

Contents

require 'papa/command/git/fetch'
require 'papa/command/git/checkout'
require 'papa/runner'
require 'papa/helper/output'

module Papa
  module Task
    class Base
      def run
        perform_task
        result
      end

      private

      def perform_task
        runner = Runner.new(queue)
        @success = runner.run
      end

      def result
        if @success
          success_message
        else
          failure_message
          exit 1
        end
      end

      def build_branch
        @build_branch ||= "#{@build_type}/#{@version}"
      end

      def check_if_build_branch_exists
        queue = [
          Command::Git::Fetch.new('origin'),
          Command::Git::Checkout.new(build_branch)
        ]
        runner = Runner.new(queue)
        return if runner.run
        Helper::Output.failure 'Build branch does not exist.'
        exit 1
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
papa-1.2.0 lib/papa/task/base.rb
papa-1.1.0 lib/papa/task/base.rb
papa-1.0.0 lib/papa/task/base.rb
papa-0.7.2 lib/papa/task/base.rb
papa-0.7.1 lib/papa/task/base.rb
papa-0.7.0 lib/papa/task/base.rb