class BuPr::Git

Constants

LOCKFILE

Public Instance Methods

current_branch() click to toggle source

@return [String]

# File lib/bu_pr/git.rb, line 8
def current_branch
  @current_branch ||=
    begin
      branches.each_line do |line|
        matched = line.strip.match(/\*\s+(?<current_branch>.+)/)
        next unless matched

        break matched["current_branch"]
      end
    end
end
diff?() click to toggle source

@return [Boolean]

# File lib/bu_pr/git.rb, line 21
def diff?
  `git status`.include? LOCKFILE
end
installed?() click to toggle source

@return [Boolean]

# File lib/bu_pr/git.rb, line 26
def installed?
  system "git --help > /dev/null 2>&1"
end
push() click to toggle source
# File lib/bu_pr/git.rb, line 30
def push
  add && commit && _push
end

Private Instance Methods

_push() click to toggle source

@private

# File lib/bu_pr/git.rb, line 52
def _push
  `git push origin #{current_branch}`
end
add() click to toggle source

@private

# File lib/bu_pr/git.rb, line 37
def add
  `git add #{LOCKFILE}`
end
branches() click to toggle source

@private

# File lib/bu_pr/git.rb, line 42
def branches
  `git branch`.strip
end
commit() click to toggle source

@private

# File lib/bu_pr/git.rb, line 47
def commit
  `git commit -m "bundle update"`
end