Creating a Hobo project

A step-by-step guide to setting up Hobo development.

Hobo is a nifty thing, a better Rails than Rails, but there are a number of small roadbumps to getting a project started. This is a list of one possible way through the maze.

Assumptions

  • You're working in a Unix-like environment
  • For development purposes, you will be building a sandboxed ruby and hobo installation in you home directory
  • You are using the most recent stable version of Hobo (e.g. 1.0.x) and not the Rails 3 candidates and not v1.3

Installing the Ruby Version Manager

This allows you to keep and run multiple versions of Ruby and different libraries.

Install rvm as per its website <http://rvm.beginrescueend.com/ >. This requires that git is available:

% bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head)

Install the versions of Ruby you need

1.9.2 is best:

% rvm install 1.9.2

Follow the instructions to add this line to end of your .bash_profile, so rvm can chnage the paths for all you Ruby interpreters and libraries:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# This loads RVM into a shell session.

Source this file:

% source ~/.bash_profile

Test it is successfully installed:

% type rvm | head -1 rvm is a function

To use a particular version:

% rvm use 1.9.2

To set this as the default version:

% rvm use --default 1.9.2

Install libraries

It's easiest to pin a version of Rails for use with Hobo:

% gem install --version "=2.3.10" rails

Finally install hobo:

% gem install hobo

Create the project

Like this:

% hobo myproject

Test it:

% cd myproject % ./script/server - p 9124

Creating application components

A resource is a database model (and table) with connected views and controllers:

% ./script/generate hobo_model_resource Trial title:string description:text

A naked model is internal, it has no direct web interface:

% ./script/generate hobo_model TrialParticipant relationship:string

Controllers for static content (e.g. documentation pages, tools) can be generated by using the Hobo front controller:

% ./script/generate hobo_front_controller Docs

After the creation of any tables, a migration must be generated and used:

% ./script/generate hobo_migration

Notes

The default Hobo installation uses sqlite as a database.

For unclear reasons, sometimes rvm doesn't install sqlite as part of the standard library. You may have to install it manually:

% gem install sqlite

If the Hobo project creation errors or runs into problems, you will need to delete and recreate it as not all the necessary infrastructure has been created.