Ruby colored binoculars for your code.
RubyScope is available as a normal gem:
gem install ruby_scope
Alternatively, you can get the source from GitHub:
git clone git://github.com/adamsanderson/ruby_scope.git
If you pull the source, install with
rake install. See below for more
information on hacking around in the source.
You can invoke ruby_scope from the command line:
Usage: ruby_scope [options] path Queries: --def NAME Find the definition of instance method NAME --class-def NAME Find the definition of class method NAME --call NAME Find method calls of NAME --class NAME Find definition of NAME --variable NAME Find references to variable NAME --assign NAME Find assignments to NAME --any NAME Find any reference to NAME (class, variable, number) --custom SEXP_PATH Searches for a custom SexpPath Options: -R Recursively search folders --no-cache Do not use a cache --cache PATH Use the cache at PATH (defaults to current dir) -v, --verbose Verbose output -h, --help Show this message
Find all the places
save are called in your secret project:
ruby_scope -R --def 'run' --def 'save' ~/SecretProject
Where do I assign values to
ruby_scope -R --assign 'a' ~/SecretProject
Of course regular expressions are fair game:
ruby_scope -R --def '/^test/' ~/SecretProject
Wicked hacker? Go crazy and write your own SexpPath queries:
ruby_scope --custom 's(:call, s(:ivar, atom), :save, _)'
That finds all the saves on instance variables by the way.
Want to extend ruby_scope? Take a look at
cli.rb, at the
moment this is where all of the queries are actually generated. Have an
idea for a better caching mechanism? Look at
The source is on GitHub, so fork off:
Adam Sanderson http://endofline.wordpress.com/ firstname.lastname@example.org