Sha256: 8c51bc17f2166ed6127b1b9010d91e9b192b5a6b35c7c3c71a7177345fe76c75

Contents?: true

Size: 747 Bytes

Versions: 3

Compression:

Stored size: 747 Bytes

Contents

module Cp8Cli
  module Commands
    class Suggest

      def run
        cache_original_branch

        suggestion_branch.checkout
        suggestion_branch.push
        pull_request.open(expand: nil)

        original_branch.checkout
        original_branch.reset
      end

      private

        def cache_original_branch
          original_branch # Keep reference for later
        end

        def original_branch
          @_original_branch ||= Branch.current
        end

        def suggestion_branch
          @_suggestion_branch ||= Branch.suggestion
        end

        def pull_request
          Github::PullRequest.new(
            from: suggestion_branch,
            to: original_branch,
          )
        end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cp8_cli-6.0.1 lib/cp8_cli/commands/suggest.rb
cp8_cli-6.0.0 lib/cp8_cli/commands/suggest.rb
cp8_cli-5.0.0 lib/cp8_cli/commands/suggest.rb