Class: Avm::Tools::Git::CompleteIssue

Inherits:
Object
  • Object
show all
Includes:
EacRubyUtils::Console::Speaker, EacRubyUtils::SimpleCache
Defined in:
lib/avm/tools/git/complete_issue.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CompleteIssue



14
15
16
17
# File 'lib/avm/tools/git/complete_issue.rb', line 14

def initialize(options)
  @git = ::EacLauncher::Git::Base.new(options.fetch(:dir))
  run
end

Instance Method Details

#branchObject



26
27
28
# File 'lib/avm/tools/git/complete_issue.rb', line 26

def branch
  @git.current_branch
end

#branch_hashObject



30
31
32
# File 'lib/avm/tools/git/complete_issue.rb', line 30

def branch_hash
  @git.rev_parse("refs/heads/#{branch}")
end

#branch_nameObject



34
35
36
# File 'lib/avm/tools/git/complete_issue.rb', line 34

def branch_name
  branch.split('/')[-1]
end

#issue_idObject



38
39
40
41
# File 'lib/avm/tools/git/complete_issue.rb', line 38

def issue_id
  m = branch_name.match(/\A#{Regexp.quote('issue_')}(\d+)\z/)
  m ? m[1].to_i : nil
end

#remote_branch_hashObject



47
48
49
# File 'lib/avm/tools/git/complete_issue.rb', line 47

def remote_branch_hash
  remote_hashs["refs/heads/#{branch}"]
end

#remote_master_hashObject



43
44
45
# File 'lib/avm/tools/git/complete_issue.rb', line 43

def remote_master_hash
  remote_hashs['refs/heads/master']
end

#remote_tag_hashObject



51
52
53
# File 'lib/avm/tools/git/complete_issue.rb', line 51

def remote_tag_hash
  remote_hashs[tag]
end

#runObject



19
20
21
22
23
24
# File 'lib/avm/tools/git/complete_issue.rb', line 19

def run
  check_issue_branch
  assert_tag
  push
  remove_local_branch
end