Created
April 23, 2012 21:17
-
-
Save loz/2473927 to your computer and use it in GitHub Desktop.
Generate gems.tags from your bundle in a project
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 'bundler' | |
require 'bundler/runtime' | |
puts 'Building gems.tags from bundle' | |
outpath = 'gems.tags' | |
begin | |
runtime = ::Bundler::Runtime.new Dir.pwd, ::Bundler.definition | |
paths = runtime.specs.map(&:full_gem_path).join(' ').strip | |
system("find #{paths} -type f -name \\*.rb | ctags -f gems.tags -L -") | |
rescue | |
puts 'Unable to build, is there a Gemfile?' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how to setup this on mac osx
in ~/bin/ create bundler-ctags file with above code in
then chmod a+x ~/bin/bundler-ctags
ensure that $PATH includes ~/bin/
(you can add the following to .bash_profile:
export PATH="$HOME/bin:$PATH"
In your vimrc add:
set tags+=gems.tags
Now you can run:
bundle-ctags in the root of a project where it's Gemfile is.
Now in that project, you can press Ctrl-] to go to the function within it's definition in any gem in the bundle