class Hookshot::GitHook
Public Class Methods
new(name:)
click to toggle source
# File lib/hookshot/git_hook.rb, line 6 def initialize(name:) @name = name end
Public Instance Methods
backup()
click to toggle source
# File lib/hookshot/git_hook.rb, line 18 def backup puts "Existing #{path} found, moving to #{path}.old…" FileUtils.move(path, "#{path}.old") end
file?()
click to toggle source
# File lib/hookshot/git_hook.rb, line 14 def file? File.exist?(path) end
symlink(to:)
click to toggle source
# File lib/hookshot/git_hook.rb, line 23 def symlink(to:) puts "Symlinking #{path} to #{to.path}…" File.symlink(to.path.to_s, path.to_s) end
symlink?()
click to toggle source
# File lib/hookshot/git_hook.rb, line 10 def symlink? File.symlink?(path) end
Private Instance Methods
path()
click to toggle source
# File lib/hookshot/git_hook.rb, line 28 def path GitHooksDirectory.path.join(@name) end