Sha256: c8d6d6e004ccba69611301805a7fbf2fe216261f4736cc1d16df6e348e732749

Contents?: true

Size: 1.29 KB

Versions: 14

Compression:

Stored size: 1.29 KB

Contents

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

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

      desc 'release', 'release the current branch to production'
      method_option :cleanup, type: :boolean, desc: 'cleanup merged branches after release'
      def release(branch = nil)
        return unless yes?("Release #{current_branch.name} to production? (y/n)", :green)

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

        find_or_create_pull_request(branch)
        status = branch_status(branch)
        if status != 'success'
          return unless yes?("Branch status is currently: #{status}.  Proceed with release? (y/n)", :red)
        end

        checkout_branch Gitx::BASE_BRANCH
        run_cmd "git pull origin #{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) if options[:cleanup]
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gitx-2.14.2.ci.70.1 lib/gitx/cli/release_command.rb
gitx-2.14.1.ci.62.1 lib/gitx/cli/release_command.rb
gitx-2.14.1 lib/gitx/cli/release_command.rb
gitx-2.14.0.ci.56.1 lib/gitx/cli/release_command.rb
gitx-2.14.0 lib/gitx/cli/release_command.rb
gitx-2.13.7 lib/gitx/cli/release_command.rb
gitx-2.13.7.ci.52.1 lib/gitx/cli/release_command.rb
gitx-2.13.6 lib/gitx/cli/release_command.rb
gitx-2.13.6.ci.50.1 lib/gitx/cli/release_command.rb
gitx-2.13.5.ci.46.1 lib/gitx/cli/release_command.rb
gitx-2.13.5 lib/gitx/cli/release_command.rb
gitx-2.13.4.ci.39.1 lib/gitx/cli/release_command.rb
gitx-2.13.4 lib/gitx/cli/release_command.rb
gitx-2.13.3 lib/gitx/cli/release_command.rb