Module: Gitmore::BranchHelper

Included in:
BranchMatcher
Defined in:
lib/helpers/branch_helper.rb

Instance Method Summary collapse

Instance Method Details

#branch_exists?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/helpers/branch_helper.rb', line 5

def branch_exists?
  !`git rev-parse --verify --quiet #{matcher}`.to_s.empty?
end

#clean_status?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/helpers/branch_helper.rb', line 15

def clean_status?
  `git status --porcelain -uno`.to_s.empty?
end

#current_branchObject



19
20
21
# File 'lib/helpers/branch_helper.rb', line 19

def current_branch
  `git symbolic-ref HEAD | cut -d/ -f3-`.to_s.strip
end

#format_branch_info(repository, result) ⇒ Object



9
10
11
12
13
# File 'lib/helpers/branch_helper.rb', line 9

def format_branch_info(repository, result)
  return unless result
  puts repository.colorize(:black).on_green
  puts puts result
end

#similar_branch_exists?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/helpers/branch_helper.rb', line 23

def similar_branch_exists?
  !`git branch -a --list #{matcher}`.to_s.empty?
end