Created
December 2, 2011 18:31
-
-
Save bemurphy/1424311 to your computer and use it in GitHub Desktop.
run ctags in a post-checkout hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "shellwords" | |
def run_tags | |
`ctags -R . 2>/dev/null` | |
end | |
def project_dir | |
File.basename Dir.pwd | |
end | |
def complete_msg | |
"Tagging complete in #{Shellwords.escape project_dir}" | |
end | |
def report_done | |
growlnotify = `which growlnotify`.chomp | |
if growlnotify.length > 0 | |
`#{growlnotify} "#{complete_msg}"` | |
else | |
puts | |
puts complete_msg | |
end | |
end | |
def start_tagging | |
if pid = Process.fork | |
Process.detach(pid) | |
else | |
run_tags | |
report_done | |
end | |
end | |
# Use the .git dir to check if we are in root dir | |
if File.directory?(".git") | |
puts "Generating tags in background." | |
start_tagging | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment