class Toothpick::Git

Attributes

git_dir[R]

Public Class Methods

clone_repo(repo, target_dir) click to toggle source
# File lib/toothpick/git.rb, line 6
def self.clone_repo(repo, target_dir)
  system("git clone #{repo} #{target_dir}")
end
new(git_dir) click to toggle source
# File lib/toothpick/git.rb, line 14
def initialize(git_dir)
  @git_dir = git_dir
end
on_git?(dir) click to toggle source
# File lib/toothpick/git.rb, line 10
def self.on_git?(dir)
  return system("cd #{dir} && git rev-parse --git-dir")
end

Public Instance Methods

commit() click to toggle source
# File lib/toothpick/git.rb, line 22
def commit
  system("cd #{git_dir} "\
    "&& git add --all "\
    "&& git commit -m '#{make_commit_message}'")
end
make_commit_message() click to toggle source
# File lib/toothpick/git.rb, line 28
def make_commit_message
  "Added pick by #{ENV['USER']} on #{Time.now}"
end
push() click to toggle source
# File lib/toothpick/git.rb, line 32
def push
  system("cd #{git_dir} && git push origin master")
end
update() click to toggle source
# File lib/toothpick/git.rb, line 18
def update
  system("cd #{git_dir} && git pull --rebase")
end