module Hookshot::HooksDirectory

Constants

DEFAULT_HOOK_NAMES

Public Class Methods

create_with_default_hooks() click to toggle source
# File lib/hookshot/hooks_directory.rb, line 30
def self.create_with_default_hooks
  create
  create_default_hooks
end
exists?() click to toggle source
# File lib/hookshot/hooks_directory.rb, line 26
def self.exists?
  Dir.exist?(path)
end
hooks() click to toggle source
# File lib/hookshot/hooks_directory.rb, line 46
def self.hooks
  Dir.glob("#{path}/*").map do |file|
    Hook.new(name: File.basename(file))
  end
end
path() click to toggle source
# File lib/hookshot/hooks_directory.rb, line 52
def self.path
  Hookshot.current_working_directory.join(".hooks")
end

Private Class Methods

create() click to toggle source
# File lib/hookshot/hooks_directory.rb, line 35
                     def self.create
  puts "`.hooks` directory not found. Creating it…"
  Dir.mkdir(path.to_s)
end
create_default_hooks() click to toggle source
# File lib/hookshot/hooks_directory.rb, line 40
                     def self.create_default_hooks
  DEFAULT_HOOK_NAMES.each do |git_hook|
    Hook.new(name: git_hook).create
  end
end