Sha256: 760486fe247436823c3343f5ad6f1281c1c3c7715e75c7bbb1d6b1d3fd520767

Contents?: true

Size: 712 Bytes

Versions: 2

Compression:

Stored size: 712 Bytes

Contents

#!/usr/bin/env ruby
scripts_dir =  File.expand_path "../../lib/scripts/", __FILE__
hooks_dir = File.expand_path ".git/hooks", Dir.pwd

script_files = Dir.entries(scripts_dir)
script_files.delete(".")
script_files.delete("..")


script_files.each do |file|
  path_to_script = File.expand_path file, scripts_dir
  path_to_hook = File.expand_path file, hooks_dir
  command = "ln -s '#{path_to_script}' '#{path_to_hook}'"

  puts "Issuing command: #{command}"

  `#{command}`
  if $?.exitstatus != 0
    puts "Failed
    If a hook file already exists then we refuse to clobber it,
    you'll have to delete it manually, or have it call the functionality
    in our hook."
    exit 1
  end
end

puts "Success"
exit 0

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sentia_git_hooks-0.2.0 bin/sentia_git_hooks
sentia_git_hooks-0.1.2 bin/sentia_git_hooks_install