Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.