class GitFlower::GitRepository

Public Class Methods

new(path_to_repo) click to toggle source
# File lib/git_flower/git_repository.rb, line 5
def initialize(path_to_repo)
  @repo = find_git_repo(path_to_repo)
end

Public Instance Methods

branch_up_to_date?(branch_name) click to toggle source
# File lib/git_flower/git_repository.rb, line 37
def branch_up_to_date?(branch_name)
  @repo.revparse(branch_name) == @repo.revparse("origin/#{branch_name}")
end
checkout_branch(branch_name) click to toggle source
# File lib/git_flower/git_repository.rb, line 17
def checkout_branch(branch_name)
  @repo.branch(branch_name).checkout
end
develop_up_to_date?() click to toggle source
# File lib/git_flower/git_repository.rb, line 29
def develop_up_to_date?
  branch_up_to_date?('develop')
end
find_git_repo(initial_dir) click to toggle source
# File lib/git_flower/git_repository.rb, line 9
def find_git_repo(initial_dir)
  if Dir.exist?('.git')
    Git.open(initial_dir)
  else
    raise GitError, "Please navigate to the root of your git repository to use this gem."
  end
end
has_added_files?() click to toggle source
# File lib/git_flower/git_repository.rb, line 21
def has_added_files?
  !@repo.status.added.empty?
end
has_existing_branch_name?(branch_name) click to toggle source
# File lib/git_flower/git_repository.rb, line 33
def has_existing_branch_name?(branch_name)
  !@repo.branches.local.map(&:name).select { |name| name =~ /^#{branch_name}.*/ }.empty?
end
master_up_to_date?() click to toggle source
# File lib/git_flower/git_repository.rb, line 25
def master_up_to_date?
  branch_up_to_date?('master')
end