Blog ยป Trying HOBO for Rails 3.2 -or- Trying an unreleased Gem directly from GitHub
Posted on 07 Aug 2012 11:41
Hobo is an excellent framework to generate production ready applications in a minute. However, it's not realeased yet for Rails 3.2 . You can use the strategy described here in general to create projects installing edge gems directly from GitHub.
First we need to create a project to define a gemset that will contain hobo. I assume that you already have RVM.
mkdir new-project--hobo
cd new-project--hobo
rvm use --create --rvmrc 1.9.3@new-project--hobo
Create the Gemfile to contain prerequisites of Hobo
#Prerequisites of hobo gem 'will_paginate' gem 'jquery-rails' gem 'jquery-ui-themes' gem 'rails', '~>3.2'
And "$ bundle install"
Next get a clone of hobo into the project and install it
new-project--hobo>$ git clone git://github.com/tablatom/hobo.git
pushd hobo
rake gem[build,force]
rake gem[install,force]
popd
Now you've got your hobo gem so that you can create new rails projects instantly with it.
To create a new project, I suggest that you copy the gemset to the gemset of the new project
mkdir myproject
pushd myproject
rvm use @new-project--hobo
SOURCE=`rvm gemset gemdir`
rvm use --create --rvmrc @myproject
TARGET=`rvm gemset gemdir`
cp -a $SOURCE/* $TARGET #Now you've got hobo gems in your project gemset
popd
hobo new myproject #Now we are back to creating a normal hobo project
cd myproject
hobo g setup_wizard
Enjoy your new Hobo project.
Note I made a thor script to copy a gemset better than repeating the commands above: https://gist.github.com/3403866
You can generalize this strategy to create gemsets to initialize other projects. With or without edge gems. Even for standard Rails. It saves a lot of time not to download the gems. For the gemsets that I use as project factories I use the name pattern:
new-project--<FactoryName>
After going through all that hassle you see this on executing hobo:
Set the HOBODEV ENV variable to your local hobo git-repository path
in order to use your local dev version instead of the installed gem.
That means you can just clone Hobo and use it. Maybe you could use the idea here to try out other gems in development.
Nevertheless, once you have created a hard to install gemset you can use it to initialize other gemsets easily using my thor script: https://gist.github.com/3403866
#thor gemset:new target-gemset -s source-gemset thor gemset:new my-new-project -s my-hobo-edge-gemset
If you like this page, please spread the word:
You can contact me if you have questions or corrections.