Created
June 1, 2012 16:43
-
-
Save svperfecta/2853467 to your computer and use it in GitHub Desktop.
Rakefile to Generate Emacs CTAGS
This file contains hidden or 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
# 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