class AmusingGit::GitHook

Public Class Methods

new(hook_file) click to toggle source
# File lib/amusing_git/git/git_hook.rb, line 3
def initialize(hook_file)
  @hook_file = hook_file
end

Public Instance Methods

amusing?() click to toggle source
# File lib/amusing_git/git/git_hook.rb, line 26
def amusing?
  File.read(@hook_file).include? 'amusing_git amuse'
end
configure_amusing_git!() click to toggle source
# File lib/amusing_git/git/git_hook.rb, line 16
def configure_amusing_git!
  `echo "amusing_git amuse" >> #{@hook_file}`
end
create!() click to toggle source
# File lib/amusing_git/git/git_hook.rb, line 11
def create!
  `touch #{@hook_file}`
  `chmod 777 #{@hook_file}`
end
exists?() click to toggle source
# File lib/amusing_git/git/git_hook.rb, line 7
def exists?
  File.file? @hook_file
end
remove_amusing_git!() click to toggle source
# File lib/amusing_git/git/git_hook.rb, line 20
def remove_amusing_git!
  content = File.read(@hook_file)
  new_content = content.gsub('amusing_git amuse', '')
  File.open(@hook_file, 'w').write(new_content)
end