Project

ruby_scope

0.01
No commit activity in last 3 years
No release in over 3 years
A ruby hacker's search tool. Quickly interrogate your code, seek out classes, methods, variable assignments, and more.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.9.8

Runtime

 Project Readme

RubyScope

Ruby colored binoculars for your code.

Installation

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.

Using RubyScope

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 run or save are called in your secret project:

ruby_scope -R --def 'run' --def 'save' ~/SecretProject

Where do I assign values to a:

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.

Hacking RubyScope

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 sexp_cache.rb.

The source is on GitHub, so fork off:

http://github.com/adamsanderson/ruby_scope

Enjoy,

Adam Sanderson
http://endofline.wordpress.com/
netghost@gmail.com