Skip to content

Instantly share code, notes, and snippets.

@jstewart
Created January 30, 2011 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstewart/802962 to your computer and use it in GitHub Desktop.
Save jstewart/802962 to your computer and use it in GitHub Desktop.
# Generate TAGS files with bundler projects. Bundle must be updated, and tags binary
# must be exuberant ctags.
namespace :tags do
namespace :generate do
desc <<-EOT
Generate a new emacs TAGS file for the current project.
Requires exuberant ctags and bundler.
EOT
task :emacs do
`ctags -R -e -f TAGS . #{gemdirs.join(' ')}`
end
desc <<-EOT
Generate a new vim TAGS file for the current project.
Requires exuberant ctags and bundler.
EOT
task :vim do
`ctags -R -f tags . #{gemdirs.join(' ')}`
end
end
def gemdirs
bundle = %x[bundle list]
gemlist = bundle.split("\n").map do |gem|
gem.match(/[\w\-_]+/)[0]
end
# Need to strip the first line since it contains no gem info
gemlist.shift
gemdirs = gemlist.map do |g|
gemdir = %x[bundle show #{g}]
%Q{"#{gemdir.chomp}"}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment