Sha256: 5ad2d2b4f48564f16820745413be92f2a0c49516e38ebdf45db86f9ebb263c93

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'thor'
require 'thegarage/gitx'
require 'thegarage/gitx/cli/base_command'
require 'thegarage/gitx/cli/update_command'
require 'thegarage/gitx/cli/integrate_command'
require 'thegarage/gitx/cli/cleanup_command'
require 'thegarage/gitx/github'

module Thegarage
  module Gitx
    module Cli
      class ReleaseCommand < BaseCommand
        include Github

        desc 'release', 'release the current branch to production'
        def release
          return unless yes?("Release #{current_branch.name} to production? (y/n)", :green)

          branch = current_branch.name
          assert_not_protected_branch!(branch, 'release')
          execute_command(UpdateCommand, :update)

          find_or_create_pull_request(branch)

          checkout_branch Thegarage::Gitx::BASE_BRANCH
          run_cmd "git pull origin #{Thegarage::Gitx::BASE_BRANCH}"
          run_cmd "git merge --no-ff #{branch}"
          run_cmd "git push origin HEAD"

          execute_command(IntegrateCommand, :integrate, 'staging')
          execute_command(CleanupCommand, :cleanup)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thegarage-gitx-2.7.2 lib/thegarage/gitx/cli/release_command.rb