racksh

About

racksh (Rack::Shell) is a console for Rack based ruby web applications.

It's like Rails' script/console or Merb's merb -i, but for any app built on Rack. You can use it to load application environment for Rails, Merb, Sinatra, Camping, Ramaze or your own framework provided there is config.ru file in app's root directory.

It's purpose is to allow developer to introspect his application and/or make some initial setup, ie. running DataMapper.auto_migrate!. It's mainly aimed at apps that don't have similar facility (like Sinatra) but can be used without problems with Merb or Rails apps.

How it works?

It loads whole application environment like Rack web server, but it doesn't run the app. Simply, methods like use or run which are normally invoked on Rack::Builder instance are being stubbed.

Installation

gem install racksh -s http://gemcutter.org

Usage

To open console run following inside rack application directory (containing config.ru file):

racksh

Specifying location of config.ru:

CONFIG_RU=~/projects/foobar/config.ru racksh

Executing ruby code inside application environment and printing results:

racksh Order.all
racksh "Order.first :created_at => Date.today"

Specifying Rack environment (default is development):

RACK_ENV=production racksh

Bugs & feature requests

Please report bugs and/or feature requests on the github issue tracker for the project located here.

Authors