class BaseBranch::GitBranch

Public Class Methods

current_branch() click to toggle source
# File lib/base_branch/git_branch.rb, line 3
def current_branch
  raise(
    BaseBranch::BaseBranchExceptions::UninitializedRepository,
    'Please initialize a git repository and have at least one branch.'
  ) if (branchez = branches).empty?

  (branchez.detect { |br| br[0, 2] == '* ' } || '').gsub('* ', '').chomp
end
master?() click to toggle source
# File lib/base_branch/git_branch.rb, line 12
def master?
  current_branch == 'master'
end

Private Class Methods

branches() click to toggle source
# File lib/base_branch/git_branch.rb, line 16
def branches
  `git branch -a`.split("\n")
end