scaffoldr
Start your Rails 3.1+ application with some default layouts, styled by
Twitter Bootstrap. The available layouts are the ones
from The Twitter Bootstrap documentation.
Usage
Add to your Gemfile:
gem 'scaffoldr', :git => 'git@github.com:EncomLabs/scaffoldr.git'
gem 'twitter-bootstrap-rails'
Right now there is a bug where we can't add the
twitter-bootstrap-rails gem as a dependency, due to bundler errors, so
include that in your Gemfile as well.
Run the twitter-bootstrap-rails static
or less
installation so
that the Twitter Bootstrap stylesheets and javascript are included in
your application manifest files. The below example installs the static
version:
rails g bootstrap:install static
Generate a bootstrap example layout for yourself. Either of the following will work:
Warning: This will remove and overwrite your application.html.erb/haml file.
rails g bootstrap:layout:starter
rails g bootstrap:layout:basic
rails g bootstrap:layout:fluid
rails g bootstrap:layout:marketing_narrow
rails g bootstrap:layout:justified_nav
The layouts are also available in HAML form:
rails g bootstrap:layout:starter --template-engine=haml
Examples
Starter
Basic
Fluid
Marketing Narrow
Justified Nav
Development
Here are the commands mikedll uses to exercise the code manually. First we presume a Rails application
template, named gemtest.rb
:
gem 'twitter-bootstrap-rails'
gem 'haml'
gem 'scaffoldr', '0.1.0', :path => '/home/USERHOMEDIRECTORY/work/scaffoldr'
Then run these two commands to rapidly execute a full new app and
scaffold action. The second assumes you're already in the target app
directory, dino_dictionary. That is, it assumes you are in the middle
of a redeploy loop. Below "dino dictionary" is used as the name of the app, but
that's arbitrary of course.
rm -rf dino_dictionary; rails new dino_dictionary -m ~/PATH/TO/gemtest.rb
cd ..; cd dino_dictionary; rails g bootstrap:install static; rails g bootstrap:layout:starter --template-engine=haml; rails s
Tips
-
Look at the rails generators from other gems such as simple_form to
get an idea of how they work.
-
The command-line invocation is derived from
the module namespacing, and directory structure, of where you place
the generator file in the generators directory.
Contributors
Copyright
Copyright (c) 2013 Encom Labs. See LICENSE.txt for further details.