Sha256: 2a982f12c9cdba8cc3f838cd22132c9ce33a5607daabbc926f185d04cf96afd0

Contents?: true

Size: 491 Bytes

Versions: 1

Compression:

Stored size: 491 Bytes

Contents

require 'pathname'

module Penchant
  class Hooks
    HOOKS_DIR = 'script/hooks'
    GIT_HOOKS_DIR = '.git/hooks'

    def self.installed?
      if File.directory?(HOOKS_DIR)
        Dir[File.join(HOOKS_DIR, '*')].each do |file|
          target = File.join(GIT_HOOKS_DIR, File.basename(file))
          return false if !File.symlink?(target)
          return false if !File.expand_path(File.readlink(target)) == File.expand_path(file)
        end

        true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
penchant-0.2.13 lib/penchant/hooks.rb