By2

Commandline tool for querying a barnyard2 database.

Installation

gem install by2

Configuration

mkdir $HOME/.by2
touch $HOME/.by2/database.yml
touch $HOME/.by2/env.yml

Place database credentials in database.yml. You can have multiple database environments configured in database.yml. By default, by2 will try to use the "development" environment. It is recommended that you set the environment you want to use in env.yml. For example, if env.yml contains the string "production", then by2 will use the production database creds in database.yml. You can also set the environment variable BY2_ENV= (which takes precedence over env.yml) to select the database environment.

Usage

by2 -h # shows basic usage
by2 -H # shows man page
by2 -m "128.0.0.1:80 -> 128.0.0.2:81" # query database from dump string

Development

Dependencies

You should have a local install of postgres.

Setup

  • Check out the code: git clone [email protected]:by2.git

  • Create databases: execute ddl in config/setup.sql

  • Copy config/database.yml.example to config/database.yml and set the credentials appropriately.

  • Run db Migrations: rake db:migrate BY2_ENV=development rake db:migrate BY2_ENV=test

  • Populate your local db with fixture data: BY2_ENV=development rake db:fixtures:load BY2_ENV=test rake db:fixtures:load

  • Run tests: rake spec