class YSI::Git

Public Class Methods

new(executor, working_dir = Dir.pwd) click to toggle source
# File lib/yes_ship_it/git.rb, line 3
def initialize(executor, working_dir = Dir.pwd)
  @executor = executor
  @working_dir = working_dir
end

Public Instance Methods

needs_push?() click to toggle source
# File lib/yes_ship_it/git.rb, line 18
def needs_push?
  local_master = run_git(["rev-parse", "master"])
  remote_master = run_git(["rev-parse", "origin/master"])
  base = run_git(["merge-base", "master", "origin/master"])

  remote_master == base && local_master != remote_master
end
origin() click to toggle source
# File lib/yes_ship_it/git.rb, line 14
def origin
  run_git(["remote", "-v"]).match(/origin\s+(.*?)(\.git)?\s+\(push\)/)[1]
end
push() click to toggle source
# File lib/yes_ship_it/git.rb, line 26
def push
  run_git(["push"])
end
run_git(args) click to toggle source
# File lib/yes_ship_it/git.rb, line 8
def run_git(args)
  Dir.chdir(@working_dir) do
    @executor.run_command(["git"] + args)
  end
end