These are modularized Rails application templates. The templates can be used on their own but more powerful app generation is possible through the
- modular structure
- uses git, every module makes a separate commit
- guiding questions or options through the LEGOS environment variable
The simplest way to use the template is to just provide the URL of
app_lego.rb to the rails app generator and answer the questions.
$ rails -m http://github.com/lackac/app_lego/raw/master/app_lego.rb my_app
The options and modules can be passed in through the
LEGOS environment variable. If this is set the generator won't ask whether it should use braid and which modules it should use.
Listing all the available options and modules:
$ LEGOS="braid,rspec,haml,jquery,couchdb,locale,misc" rails -m http://github.com/lackac/app_lego/raw/master/app_lego.rb my_app
App LEGO can use Braid to manage vendor branches. If braid is selected all
plugin calls will install through braid, but if it's not
plugin calls will use the default
The basic generator initializes the Rails application in a git repository, removes unnecessary files and directories, sets up
.gitignore files and freezes Edge Rails.
The RSpec module remove the
test directory and installs the plugins necessary for RSpec. It also runs the rspec generator.
The Haml module initializes the app for Haml and Compass. Sass files for Compass are installed in
app/stylesheets and it uses the Blueprint css library. Other modules take care of generating haml template files if haml was installed.
The locale module will download localization files from Sven Fuchs' rails-i18n repository. The generator will ask for the list of the localizations the user wants, but it can be given through the
LOCALES environment variable too. The list is comma separated, and where no extension is given
.yml is assumed. The first locale in the list will be used as the default locale. Example:
$ LOCALES='hu,de,nl.rb' LEGOS='locale' rails -m http://github.com/lackac/app_lego/raw/master/app_lego.rb my_app
The misc module inserts miscellaneous files into the application. These include a basic
application_controller.rb, some helpers, a basic layout with flashes taken care of and some initializers.
So far this is all. Feel free to fork the repository and send me pull requests if you find out something cool.
I borrowed some ideas from Jeremy McAnally's rails-templates repository.
App LEGO is licensed under the MIT License.