Skip to content

Commit

Permalink
update README to provide instructions for generating the application …
Browse files Browse the repository at this point in the history
…using the template script
  • Loading branch information
fortuity committed Jun 24, 2010
1 parent d4925ec commit 87d8dcf
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
20 changes: 15 additions & 5 deletions README.textile
Expand Up @@ -2,6 +2,8 @@ h1. Rails3-Mongoid-Devise

You can use this project as a starting point for a Rails web application. It requires Rails 3 and uses "Mongoid":http://mongoid.org/ for data storage and "Devise":http://github.com/plataformatec/devise for user management and authentication.

You can clone this app with git (see "Downloading the Example" below). Or you can generate a new Rails app using the app as a template (see "Generating the Application" below).

h1. "Building It" Tutorial

A complete walkthrough tutorial is available on the GitHub wiki:
Expand All @@ -18,8 +20,6 @@ This is a barebones application that serves to demonstrate Mongoid and Devise wo

All the functionality of Devise is available (see a description of "Devise":http://github.com/plataformatec/devise for details). However, in this application, all you can do is visit a home page and see a list of users. With the default user's email and password (supplied below), you can log in and view details for each user.

The application uses the default Rails template engine (erb files). You may wish to use an alternative template engine such as Haml.

No testing (RSpec or otherwise) is implemented. Devise and Mongoid have their own test suites and this app only serves to demonstrate Mongoid and Devise working together on Rails 3.

h2. Dependencies
Expand All @@ -46,14 +46,24 @@ If you intend to deploy to "Heroku":http://heroku.com/, note that Heroku support
If you don't have MongoDB installed on your computer, you'll need to install it and set it up to be always running on your computer (run at launch). On the Mac OS X, the easiest way to install MongoDB is to install "Homebrew":http://mxcl.github.com/homebrew/ and then use this script to install and set up MongoDB:
"http://gist.github.com/265272":http://gist.github.com/265272.

h2. Download
h2. Generating the Application

The source code is managed with Git (a version control system) and hosted at GitHub. You'll need Git on your machine (install it from [http://git.or.cz/](http://git.or.cz/)).
To get started with a new Rails application based on this example, you can generate a new Rails app:

@$ rails new app_name -m http://github.com/fortuity/rails3-mongoid-devise/raw/master/template.rb@

This creates a new Rails app (with the @app_name@ you provide) on your computer. It includes everything in the example app (as described in the "tutorial":http://wiki.github.com/fortuity/rails3-mongoid-devise/tutorial-walkthrough). Plus it offers you the option of setting up your view files using the Haml templating language.

You can download the app ("clone the repository") with the command
If you wish to "change the recipe" to generate the app with your own customized options, you can download the app and edit the file *template.rb*.

h3. Downloading the Example

I recommend "Generating the Application" as described above. If that doesn't work, or you simply wish to examine the example code, you can download the app ("clone the repository") with the command

@$ git clone git(at)github.com:fortuity/rails3-mongoid-devise.git@

The source code is managed with Git (a version control system) and hosted at GitHub. You'll need Git on your machine (install it from [http://git.or.cz/](http://git.or.cz/)).

h2. Getting Started

h3. Configure Email
Expand Down
10 changes: 10 additions & 0 deletions TUTORIAL.textile
Expand Up @@ -6,6 +6,16 @@ h1. Tutorial

This tutorial documents each step that you must follow to create this application. Every step is documented concisely, so a complete beginner can create this application without any additional knowledge. However, no explanation is offered for any of the steps, so if you are a beginner, you're advised to look for an introduction to Rails elsewhere. Refer to the "Rails Guides":http://guides.rubyonrails.info/ site for help if you are a beginner.

h2. Generating the Application

To create the application, you can follow each step in this tutorial and cut and paste the code into your own files. However, it may be easier to generate a new Rails app using the example as a template:

@$ rails new app_name -m http://github.com/fortuity/rails3-mongoid-devise/raw/master/template.rb@

This creates a new Rails app (with the @app_name@ you provide) on your computer. It includes everything in the example app (as described in the "tutorial":http://wiki.github.com/fortuity/rails3-mongoid-devise/tutorial-walkthrough). Then you can read through the tutorial with the code already on your computer.

If you wish to "change the recipe" to generate the app with your own customized options, you can download the app and edit the file *template.rb*.

h2. Assumptions

This tutorial is based on Rails 3 beta 4, Mongoid 2 beta 7, and Devise 1.1.rc2.
Expand Down
14 changes: 13 additions & 1 deletion template.rb
@@ -1,8 +1,16 @@
# Application Generator Template
# Modifies a Rails app to use Mongoid and Devise
# Usage: rails new app_name -m http://github.com/fortuity/rails3-mongoid-devise/master/template.rb
# Usage: rails new app_name -m http://github.com/fortuity/rails3-mongoid-devise/raw/master/template.rb

# More info: http://github.com/fortuity/rails3-mongoid-devise/

# If you are customizing this template, you can use any methods provided by Thor::Actions
# http://rdoc.info/rdoc/wycats/thor/blob/f939a3e8a854616784cac1dcff04ef4f3ee5f7ff/Thor/Actions.html
# and Rails::Generators::Actions
# http://github.com/rails/rails/blob/master/railties/lib/rails/generators/actions.rb

puts "Modifying a new Rails app to use Mongoid and Devise..."
puts "Any problems? See http://github.com/fortuity/rails3-mongoid-devise/issues"

if yes?('Would you like to use the Haml template system? (yes/no)')
haml_flag = true
Expand Down Expand Up @@ -314,4 +322,8 @@ def show
FILE
end

puts "checking everything into git..."
git :add => '.'
git :commit => "-m 'modified Rails app to use Mongoid and Devise'"

puts "Done setting up your Rails app with Mongoid and Devise."

0 comments on commit 87d8dcf

Please sign in to comment.