Skip to content

kysnm/rails3-application-templates

 
 

Repository files navigation

Rails 3.2 Application Templates

These application generator templates give you a Rails 3.2 starter app you can deploy in minutes.

Applications

The templates can be used to build the following complete applications:

Tutorials

There are detailed tutorials to show how each application is built:

Options

The application generator templates will ask you for various preferences:

  • Would you like to use Haml instead of ERB?
  • Would you like to use RSpec instead of TestUnit?
  • Would you like to use factory_girl for test fixtures with RSpec?
  • Would you like to use Cucumber for your BDD?
  • Would you like to use Guard to automate your workflow?
  • Would you like to use Mongoid to connect to a MongoDB database?
  • Would you like to use Devise for authentication?
  • Would you like to use OmniAuth for authentication?
  • Would you like to set a robots.txt file to ban spiders?
  • Would you like to use ‘rails-footnotes’ during development?
  • Would you like to add support for subdomains?
    1. No
    2. One subdomain per user (like Basecamp)
  • Which front-end framework would you like for HTML5 and CSS3?
    1. None
    2. Zurb Foundation
    3. Twitter Bootstrap
    4. Skeleton
    5. Normalize CSS for consistent styling

Follow on Twitter Follow on Twitter

Follow the project on Twitter: @rails_apps. Please tweet some praise if you like what you’ve found.

Suggested Use

You can quickly generate a Rails web application using just the rails new command. In practice, experienced Rails developers typically add an assortment of useful additional packages (known as RubyGems, or just “gems”) before beginning development of any web application. A developer often uses the same set of gems to get started and may create a “starter app” that can be copied and reused for any new project. Often a developer will create an “application template” to automate the creation of starter apps.

Rails application templates are Ruby scripts used with the "rails new myapp -m" command to generate a Rails web application.

Application templates commonly integrate popular gems that many Rails developers include in a starter app. It can be a hassle to integrate some of the most commonly used gems, particularly when new versions are released and there are minor “gotchas” that interfere with gems working together. By using these application templates, you’ll have a ready-to-run app without the integration “gotchas”. Each has a detailed tutorial so you’ll see exactly how the application was assembled.

These application templates were created using the Rails Apps Composer gem which provides a convenient way to assemble a reusable application template by selecting various “recipes” for popular Rails development gems.

You can use the application templates from this repository to generate a starter app directly. You can edit the templates to customize the script to generate a customized starter app. Or you can use the Rails Apps Composer gem to assemble a selection of recipes for a customized starter app.

Dependencies

Before generating your application, you will need:

  • The Ruby language (version 1.9.3)
  • Rails 3.2

See Installing Rails 3.2 for detailed instructions and advice.

Generating the Application

Use the "rails new myapp -m" command to generate a Rails web application.

This creates a new Rails app (with the myapp name you provide) on your computer.

You can add the -T -O flags to skip Test::Unit files and Active Record files.

Template for Rails 3 + Devise + RSpec + Cucumber

To build the “rails3-devise-rspec-cucumber” example application, run the command:

$ rails new myapp -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-devise-rspec-cucumber-template.rb -T

Use the -T flag to skip Test::Unit files.

Template for Rails 3 + Mongoid + Devise

To build the “rails3-mongoid-devise” example application, run the command:

$ rails new myapp -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-mongoid-devise-template.rb -T -O

Use the -T -O flags to skip Test::Unit files and Active Record files.

Template for Rails 3 + Mongoid + OmniAuth

To build the “rails3-mongoid-omniauth” example application, run the command:

$ rails new myapp -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-mongoid-omniauth-template.rb -T -O

Use the -T -O flags to skip Test::Unit files and Active Record files.

Template for Rails 3 + Subdomains

To build the “rails3-subdomains” example application, run the command:

$ rails new myapp -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-subdomains-template.rb -T -O

Use the -T -O flags to skip Test::Unit files and Active Record files.

Troubleshooting

Problems? Check the issues.

Problems with Rake

If you see:

The template ... could not be loaded.
Error: You have already activated rake 0.8.7, but your Gemfile requires rake 0.9.x.
Consider using bundle exec.

If you are using Ruby 1.9.2, you must update the standard Ruby installation from Rake 0.8.7 to Rake 0.9.2 (or newer) before using the application templates to generate a new Rails app. It’s advisable to update to Ruby 1.9.3 which will provide Rake 0.9.2. See Installing Rails 3.2.

Problems with “Certificate Verify Failed”

Are you getting an error “OpenSSL certificate verify failed” when you try to generate a new Rails app from an application template? See suggestions to resolve the error Certificate Verify Failed.

Documentation and Support

This is the only documentation.

The Recipes

For your reference, here’s an annotated list of available recipes for the Rails Apps Composer gem. For an up-to-date list, browse the repository recipes directory.

Customizing the Template

If you wish to “change the recipe” to generate the app with your own customized options, you can copy and edit the template file. However, it is better to use the Rails Apps Composer gem to create a new application template. You’ll find newer versions of the recipes that make up the application template. You may find issues have been identified and (perhaps) fixed. And it will be easier to maintain your application template if you work from the Rails Apps Composer gem.

Writing Recipes

To understand the code in these templates, take a look at Thor::Actions. Your recipes can use any methods provided by Thor::Actions or Rails::Generators::Actions.

About Rails Application Templates

Cooking Up A Custom Rails 3 Template (11 Oct 2010) by Andrea Singh
Rails Application Templates (16 Sept 2010) by Collin Schaafsma
Application templates in Rails 3 (18 Sept 2009) by Ben Scofield
Railscasts: App Templates in Rails 2.3 (9 Feb 2009) by Ryan Bates
Rails templates (4 Dec 2008) by Pratik Naik

Similar Projects

There are many similar projects. Here’s an annotated list of other Rails application template projects and Rails examples, tutorials, and starter apps.

Issues

Any issues? Please create an issue on GitHub.

Where to Get Help

Your best source for help with problems is Stack Overflow. Your issue may have been encountered and addressed by others.

You can also try Rails Hotline, a free telephone hotline for Rails help staffed by volunteers.

Contributing

If you make improvements to this application, please share with others.

Send the author a message, create an issue, or fork the project and submit a pull request.

If you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I’ll add a note to the README so that others can find your work.

Credits

Daniel Kehoe (http://danielkehoe.com/) created these templates.

Are the templates useful to you? Follow the project on Twitter:
@rails_apps
and tweet some praise. I’d love to know you were helped out by what I’ve put together.

License

Public Domain Dedication

This work is a compilation and derivation from other previously released works. With the exception of various included works, which may be restricted by other licenses, the author or authors of this code dedicate any and all copyright interest in this code to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this code under copyright law.

About

Application templates for Rails 3.2 starter apps you can deploy in minutes.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%