Sha256: d8c458e022718a6c6711aae59758a73854e6b91030b64a9c6734e14066b8cacf

Contents?: true

Size: 1.49 KB

Versions: 91

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

require 'avm/tools/core_ext'
require 'eac_git/local'

module Avm
  module Git
    module Issue
      class Complete
        require_sub __FILE__, include_modules: true
        enable_simple_cache
        enable_speaker

        BRANCH_NAME_ISSUE_ID_PATTERN =

          attr_reader :dir, :skip_validations

        def initialize(options)
          consumer = ::EacRubyUtils::OptionsConsumer.new(options)
          @dir, @skip_validations = consumer.consume_all(:dir, :skip_validations)
          validate_skip_validations
          consumer.validate
        end

        def start_banner
          validations_banner
        end

        def run
          return false unless valid?

          assert_tag
          push
          remove_local_branch
          clipboard_copy_tracker_message
          true
        end

        def issue_id
          branch ? issue_id_parser.parse(branch_name) : nil
        end

        # @return [EacRubyUtils::RegexpParser]
        def issue_id_parser
          /\A#{Regexp.quote('issue_')}(\d+)\z/.to_parser { |m| m[1].to_i }
        end

        private

        # @return [EacGit::Local]
        def eac_git_uncached
          ::EacGit::Local.new(dir)
        end

        def git_execute(args, exit_outputs = {})
          r = launcher_git.execute!(args, exit_outputs: exit_outputs)
          r.is_a?(String) ? r.strip : r
        end

        def launcher_git_uncached
          ::Avm::Git::Launcher::Base.new(dir)
        end
      end
    end
  end
end

Version data entries

91 entries across 91 versions & 2 rubygems

Version Path
eac_tools-0.70.1 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.70.0 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.69.1 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.69.0 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.68.0 sub/avm-git/lib/avm/git/issue/complete.rb
avm-git-0.13.3 lib/avm/git/issue/complete.rb
eac_tools-0.67.1 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.67.0 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.66.0 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.65.1 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.65.0 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.64.0 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.63.0 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.62.1 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.62.0 sub/avm-git/lib/avm/git/issue/complete.rb
avm-git-0.13.2 lib/avm/git/issue/complete.rb
eac_tools-0.61.1 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.61.0 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.60.3 sub/avm-git/lib/avm/git/issue/complete.rb
eac_tools-0.60.2 sub/avm-git/lib/avm/git/issue/complete.rb