module Fuci::Git

Constants

CURRENT_BRANCH_COMMAND
MASTER
PULL_MERGE_SHA_FROM_NUMBER_COMMAND
PULL_NUMBER_FROM_SHA_COMMAND
REMOTE_REPO_COMMAND
REMOTE_SHA_FROM_BRANCH_COMMAND

Public Instance Methods

current_branch_name() click to toggle source
# File lib/fuci/git.rb, line 14
def current_branch_name
  with_popen current_branch_command
end
pull_merge_sha_from(branch_name) click to toggle source
# File lib/fuci/git.rb, line 30
def pull_merge_sha_from branch_name
  pull_number = pull_number_from branch_name
  with_popen pull_merge_sha_command(pull_number)
end
pull_number_from(branch_name) click to toggle source
# File lib/fuci/git.rb, line 35
def pull_number_from branch_name
  remote_sha  = remote_sha_from branch_name

  begin
    with_popen pull_number_from_sha_command(remote_sha)
  rescue NoResponseError
    raise NoPullError
  end
end
remote_master_sha() click to toggle source
# File lib/fuci/git.rb, line 22
def remote_master_sha
  with_popen remote_sha_from_branch_command(MASTER)
end
remote_repo_name() click to toggle source
# File lib/fuci/git.rb, line 18
def remote_repo_name
  with_popen remote_repo_command
end
remote_sha_from(branch_name) click to toggle source
# File lib/fuci/git.rb, line 26
def remote_sha_from branch_name
  with_popen remote_sha_from_branch_command(branch_name)
end

Private Instance Methods

current_branch_command() click to toggle source
# File lib/fuci/git.rb, line 57
def current_branch_command
  CURRENT_BRANCH_COMMAND
end
pull_merge_sha_command(pull_number) click to toggle source
# File lib/fuci/git.rb, line 69
def pull_merge_sha_command pull_number
  PULL_MERGE_SHA_FROM_NUMBER_COMMAND.(pull_number)
end
pull_number_from_sha_command(sha) click to toggle source
# File lib/fuci/git.rb, line 73
def pull_number_from_sha_command sha
  PULL_NUMBER_FROM_SHA_COMMAND.(sha)
end
remote_repo_command() click to toggle source
# File lib/fuci/git.rb, line 61
def remote_repo_command
  REMOTE_REPO_COMMAND
end
remote_sha_from_branch_command(branch_name) click to toggle source
# File lib/fuci/git.rb, line 65
def remote_sha_from_branch_command branch_name
  REMOTE_SHA_FROM_BRANCH_COMMAND.(branch_name)
end
with_popen(command) click to toggle source
# File lib/fuci/git.rb, line 47
def with_popen command
  IO.popen command do |io|
    if first_line = io.first
      first_line.chomp
    else
      raise NoResponseError
    end
  end
end