Smartlogic Solutions Rails-app-in-a-box.
Rails Application Template files are all in the root of the project directory.
template.rb
is the main file, it calls the others as needed. Most of the
other template files load external files into the new project. Those files are
contained in the child directories under the root of this project.
The application creation process works roughly like this:
- load
environment.rb
- setup the environment (based on jtrupiano's environmentalist gem). - load some standard gems and plugins
capify!
if needed- clean up the project directory and do a git checkin.
- load
users.rb
- setup authlogic and the requisite models, views, and controllers - load
haml.rb
- setup compass and haml for content rendering. - load
javascript.rb
- setup jammit for javascript asset management. - save the geminstaller.yml files (see Application Notes below)
- load
start.rb
- setup a start controller so you've got something to work with. - setup default factory and some rake tasks to make seeding development data easy
- load
test.rb
- setup the testing environment and generate the initial tests. - create and migrate the database.
rails -m http://github.com/smartlogic/rails-templates/raw/master/template.rb $PROJECT_NAME
That's it.
From here you should be able to start the built in server or edit and link config/development/apache.conf into your passenger .conf dir and run the application.
Tests should also run out of the box.
To run the template from a local directory (working copy), add the LOCAL=true
env argument and reference template.rb
locally. For example:
LOCAL=true rails -m rails-templates/template.rb $PROJECT_NAME
The geminstaller_builder gem.
You'll notice we don't use the normal gem
command, since we use geminstaller
on our projects. If you need to add a gem to the template, use the form
geminstaller '$GEMNAME'
instead of gem '$GEMNAME'
. If it's a gem that's
only needed in one environment (e.g., "test"), call geminstaller '$GEMNAME', :test
.
Make sure all your calls to geminstaller
come before @geminstaller.save
,
that's when the geminstaller.yml files are written.