Sha256: 736e1dbaa129509af69390a76c51ab9774c3d99c1c8f00c1c3613df9a3df47d8

Contents?: true

Size: 676 Bytes

Versions: 18

Compression:

Stored size: 676 Bytes

Contents

#!/usr/bin/env ruby -rrubygems

template = <<EOS
#!/usr/bin/env ruby -rrubygems
require 'pre-commit'

exit_status = PreCommit.checks_to_run.inject(true) do |acc, cmd|
  acc = cmd.call && acc
end

exit(exit_status ? 0 : 1)

EOS

if ARGV[0] != "install"
  puts "Usage: pre-commit install"
  exit(1)
end

if !File.exists?(".git")
  puts "No .git directory found."
  exit(1)
end

if File.exists?(".git/hooks/pre-commit")
  puts "Not overwriting existing hook: .git/hooks/pre-commit"
  exit(1)
end

File.open(".git/hooks/pre-commit","w") {|f| 
  f.write(template)
}

require 'fileutils'

FileUtils.chmod(0755, ".git/hooks/pre-commit")

puts "Installed hook: .git/hooks/pre-commit"

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pre-commit-0.1.18 bin/pre-commit
pre-commit-0.1.17 bin/pre-commit
pre-commit-0.1.16 bin/pre-commit
pre-commit-0.1.15 bin/pre-commit
pre-commit-0.1.14 bin/pre-commit
pre-commit-0.1.13 bin/pre-commit
pre-commit-0.1.12 bin/pre-commit
pre-commit-0.1.11 bin/pre-commit
pre-commit-0.1.10 bin/pre-commit
pre-commit-0.1.9 bin/pre-commit
pre-commit-0.1.8 bin/pre-commit
pre-commit-0.1.7 bin/pre-commit
pre-commit-0.1.6 bin/pre-commit
pre-commit-0.1.5 bin/pre-commit
pre-commit-0.1.4 bin/pre-commit
pre-commit-0.1.3 bin/pre-commit
pre-commit-0.1.2 bin/pre-commit
pre-commit-0.1.1 bin/pre-commit