/cpangrep

Search code on CPAN with Regexps

Primary LanguagePerl

CPAN Grep

This is the code behind http://grep.cpan.me. Unless you want to add something you probably want to use the site, not try and install this ;-)

The default development configuration will index a sample CPAN from fakecpan. Indexing the whole CPAN doesn't take long, although you'll need around 4GB of RAM spare to get a decent level of performance.

Quick start

For a very quick development setup you should be able to:

  • Ensure you have Perl 5.14 or later

  • Install redis

    You just need a redis-server binary around, run-test below will start it for you.

  • Run the following:

    cpanm --installdeps .
    tools/run-test
  • Visit http://localhost:5000

  • Hack!

    Starman will pick up changes automatically, so web frontend changes should be picked up right away.

Components

If you want to work on the indexing or other aspects you might need to run these, to start with run-test may well be enough though.

  • cpangrep-index

    Run this to start with:

    bin/cpangrep-index [--cpan_dir /path/to/cpan --slab_dir /data/cpangrep/extract]

    If you omit the --cpan_dir and --slab_dir options you'll get the fakecpan configured in etc/config and shipped with this.

  • WWW::CPANGrep

    The web frontend. Run with:

    starman -Ilib lib/WWW/CPANGrep.pm

    (or other plack server.)

    There's also a version that wraps this in Plack::Debug in debug.psgi.

  • cpangrep-matcher

    Backend workers that do the matching, based on a redis queue. This should be running along with the web frontend, all the time:

    bin/cpangrep-matcher
  • Redis

    A Redis server (or several for the live version) are used for queuing jobs and also resolving matches.

Deployment

Currently the "live" tag refers to the version that is live. To push a new version:

git tag -f live
git push --tags

(See the handler for /githook for how this works.)