Skip to content

Instantly share code, notes, and snippets.

@bemurphy
Created December 2, 2011 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bemurphy/1424311 to your computer and use it in GitHub Desktop.
Save bemurphy/1424311 to your computer and use it in GitHub Desktop.
run ctags in a post-checkout hook
#!/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