Skip to content

Commit facf524

Browse files
committed
update README
1 parent 343a51d commit facf524

File tree

2 files changed

+57
-95
lines changed

2 files changed

+57
-95
lines changed

README

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ https://github.com/railsapps/rails3-devise-rspec-cucumber
1212

1313
________________________
1414

15-
Public Domain Dedication
15+
MIT License
1616

17-
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.
17+
http://www.opensource.org/licenses/mit-license

README.textile

+55-93
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ Rails 3.2 example application shows how to use "Devise":http://github.com/plataf
88

99
Best of all, there's a "detailed tutorial":http://railsapps.github.com/tutorial-rails-devise-rspec-cucumber.html to show how it's built.
1010

11-
You can clone this app or generate a new Rails application using an "application template":https://github.com/RailsApps/rails3-application-templates.
11+
You can build this application in only a few minutes using the "Rails Composer":http://railsapps.github.com/rails-composer/ tool.
1212

1313
h2. !http://twitter-badges.s3.amazonaws.com/t_logo-a.png(Follow on Twitter)!:http://www.twitter.com/rails_apps Follow on Twitter
1414

1515
Follow the project on Twitter: "@rails_apps":http://twitter.com/rails_apps. Please tweet some praise if you like what you've found.
1616

1717
h2. Tutorial
1818

19-
A complete walkthrough tutorial is available on the GitHub wiki:
19+
A complete tutorial is available:
2020

2121
h4. "View the Tutorial":http://railsapps.github.com/tutorial-rails-devise-rspec-cucumber.html
2222

2323
The tutorial documents each step to follow to create the 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. See a list of recommended resources for "Rails":http://railsapps.github.com/rails.html.
2424

25-
If you simply wish to modify the application for your own project, you can download the application and set it up as described below, without following the tutorial.
26-
2725
h2. What Is Implemented -- and What Is Not
2826

2927
This is a demonstration application that allows you to 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. Devise provides user management so a visitor can register with an email address and password and create an account. Devise provides authentication so access to the site can be limited to users who are registered and logged in.
3028

29+
The @rake db:seed@ command sets up a database with two example users. The first user is designated as an administrator and can view a administrative page when logged in. The second user is restricted from accessing the administrative page.
30+
3131
h4. Similar Examples and Tutorials
3232

3333
This is one in a series of Rails example apps and tutorials from the "RailsApps Project":http://railsapps.github.com/. See a list of additional "Rails examples, tutorials, and starter apps":http://railsapps.github.com/rails-examples-tutorials.html.
@@ -45,124 +45,80 @@ Before generating your application, you will need:
4545
* The Ruby language (version 1.9.3)
4646
* Rails 3.2
4747

48-
See "Installing Rails 3.2":http://railsapps.github.com/installing-rails.html for detailed instructions and advice.
48+
See the article "Installing Rails":http://railsapps.github.com/installing-rails.html for advice about updating Rails and your development environment.
4949

5050
h2. Getting the Application
5151

5252
You have several options for getting the code.
5353

54-
h4. Fork, Clone, or Generate?
55-
56-
_Fork:_ If you'd like to add features (or bug fixes) to improve the example application, you can fork the GitHub repo and "make pull requests":http://help.github.com/send-pull-requests/. Your code contributions are welcome!
57-
58-
_Clone:_ If you want to copy and customize the app with changes that are only useful for your own project, you can clone the GitHub repo. You'll need to search-and-replace the project name throughout the application. You probably should generate the app instead (see below).
54+
h3. Fork
5955

60-
_Generate:_ If you want to use the project as a starter app for your customized application, use the application template to generate a new version of the example app. You'll be able to give it your own project name when you generate the app. Generating the application (described below) gives you many options, such as using Haml for views, additional Devise modules, and various HTML5/CSS front-end frameworks such as Twitter Bootstrap.
56+
If you'd like to add features (or bug fixes) to improve the example application, you can fork the GitHub repo and "make pull requests":http://help.github.com/send-pull-requests/. Your code contributions are welcome!
6157

62-
h4. Clone the Repository
58+
h3. Clone
6359

64-
If you simply wish to examine the example code, you can download the code ("clone the repository") with the command
60+
If you want to copy and customize the app with changes that are only useful for your own project, you can clone the GitHub repo. You'll need to search-and-replace the project name throughout the application. You probably should generate the app instead (see below). To clone:
6561

6662
<pre>
6763
$ git clone git://github.com/RailsApps/rails3-devise-rspec-cucumber.git
6864
</pre>
6965

70-
The source code is managed with Git (a version control system). You'll need Git on your machine (install it from "http://git-scm.com/":http://git-scm.com/).
66+
You'll need "git":http://git-scm.com/ on your machine. See "Rails and Git":http://railsapps.github.com/rails-git.html.
7167

72-
h4. Using the Ready-Made Application Template
68+
h3. Generate
7369

74-
You can use an application template to generate a new version of the example app. Youll find an application template for this app in the "Rails Application Templates":https://github.com/RailsApps/rails3-application-templates repository.
70+
If you want to use the project as a starter app, use the "Rails Composer":http://railsapps.github.com/rails-composer/ tool to generate a new version of the example app. You'll be able to give it your own project name when you generate the app. Generating the application gives you many additional options.
7571

76-
To build the "rails3-devise-rspec-cucumber" example application, run the command:
72+
To build the example application, run the command:
7773

7874
<pre>
79-
$ rails new myapp -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-devise-rspec-cucumber-template.rb -T
75+
$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb -T
8076
</pre>
8177

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

8480
The @$@ character indicates a shell prompt; don't include it when you run the command.
8581

86-
This creates a new Rails app (with the name @myapp@) on your computer.
87-
88-
The application generator templates will ask you for various preferences.
89-
90-
To reproduce the example application exactly as found in the repository, make the following selections:
91-
92-
* Would you like to use "Haml":http://en.wikipedia.org/wiki/Haml instead of ERB? *no*
93-
* Would you like to use "RSpec":http://rspec.info/ instead of TestUnit? *yes*
94-
* Would you like to use "factory_girl":https://github.com/thoughtbot/factory_girl for test fixtures with RSpec? *yes*
95-
* Would you like to use "machinist":https://github.com/notahat/machinist for test fixtures with RSpec? *no*
96-
* Would you like to use "Cucumber":http://cukes.info/ for your BDD? *yes*
97-
* Would you like to use "Guard":http://intridea.com/posts/hire-a-guard-for-your-project to automate your workflow? *no*
98-
* Would you like the app to use a Gmail account to send email? *yes*
99-
* Would you like to use "Devise":http://github.com/plataformatec/devise for authentication?
100-
## No
101-
## Devise with default modules *#2*
102-
## Devise with Confirmable module
103-
## Devise with Confirmable and Invitable modules
104-
* Would you like to manage authorization with CanCan & Rolify? *no*
105-
* Which front-end framework would you like for HTML5 and CSS3?
106-
## None *#1*
107-
## "Zurb Foundation":http://foundation.zurb.com/
108-
## "Twitter Bootstrap":http://twitter.github.com/bootstrap/ (less)
109-
## "Twitter Bootstrap":http://twitter.github.com/bootstrap/ (sass)
110-
## "Skeleton":http://www.getskeleton.com/
111-
## Normalize CSS for consistent styling
112-
* Which form gem would you like?
113-
## None *#1*
114-
## simple form
115-
## simple form (bootstrap)
116-
* Would you like to use "rails-footnotes":https://github.com/josevalim/rails-footnotes during development? *no*
117-
* Would you like to set a robots.txt file to ban spiders? *yes*
118-
* Would you like to add 'will_paginate' for pagination? *no*
119-
* Add 'therubyracer' JavaScript runtime (for Linux users without node.js)? *no*
120-
121-
You can choose other selections if you don't care about matching the example application exactly.
122-
123-
h4. Use "Recipes" to Customize an Application Template
124-
125-
The application template was created using the "rails_apps_composer":https://github.com/RailsApps/rails_apps_composer gem which provides a convenient way to assemble a reusable application template by selecting various "recipes" for popular Rails development packages. Use "rails_apps_composer":https://github.com/RailsApps/rails_apps_composer if you want to customize the application template for your own starter apps.
126-
127-
h4. Edit the README
128-
129-
If you're open sourcing the app on GitHub, please edit the README file to add a description of the app and your contact info. Changing the README is important if you're using a clone of the example app. I've been mistaken (and contacted) as the author of apps that are copied from my example.
82+
This creates a new Rails app (with the name "myapp") on your computer.
13083

131-
h2. Getting Started
84+
h3. Edit the README
13285

133-
h4. About Required Gems
86+
If you're storing the app in a GitHub repository, please edit the README files to add a description of the app and your contact info. If you don't change the README, people will think I am the author of your version of the application.
13487

135-
The application uses the following gems:
88+
h2. Getting Started
13689

137-
* "rails":http://rubygems.org/gems/rails
138-
* "rspec-rails":http://rubygems.org/gems/rspec-rails
139-
* "database_cleaner":http://rubygems.org/gems/database_cleaner
140-
* "factory_girl_rails":http://rubygems.org/gems/factory_girl_rails
141-
* "cucumber-rails":http://rubygems.org/gems/cucumber-rails
142-
* "capybara":http://rubygems.org/gems/capybara
143-
* "devise":http://rubygems.org/gems/devise
90+
h3. Install the Required Gems
14491

145-
See "Example Gemfiles for Rails 3.2":http://railsapps.github.com/rails-3-2-example-gemfile.html.
92+
Check the Gemfile to see which gems are used by this application.
14693

147-
h4. Install the Required Gems
94+
If you used the "Rails Composer":http://railsapps.github.com/rails-composer/ tool to generate the example app, the application template script has already run the @bundle install@ command.
14895

149-
Install the required gems on your computer:
96+
If not, you should run the @bundle install@ command to install the required gems on your computer:
15097

151-
@$ bundle install@
98+
<pre>
99+
$ bundle install
100+
</pre>
152101

153102
You can check which gems are installed on your computer with:
154103

155-
@$ gem list --local@
104+
<pre>
105+
$ gem list
106+
</pre>
156107

157108
Keep in mind that you have installed these gems locally. When you deploy the app to another server, the same gems (and versions) must be available.
158109

159-
h2. Configure Email
110+
I recommend using "rvm":https://rvm.io/, the Ruby Version Manager, to create a project-specific gemset for the application. See the article "Installing Rails":http://railsapps.github.com/installing-rails.html.
160111

161-
You must configure the app for your email account if you want your application to send email messages, for example, if you've generated the application with the option to install the Devise @:confirmable@ module.
112+
h3. Configure Email
113+
114+
You must configure the app for your email account if you want your application to send email messages.
162115

163116
h4. Use a Gmail account
164117

165-
If you've generated the application with the option to use a Gmail account to send email, you'll need to modify the files *config/environments/development.rb* and *config/environments/production.rb* to include your Gmail username and password.
118+
You'll need to modify two files to include your Gmail username and password:
119+
120+
* *config/environments/development.rb*
121+
* *config/environments/production.rb*
166122

167123
<pre>
168124
config.action_mailer.smtp_settings = {
@@ -191,29 +147,32 @@ Open a new shell or restart your terminal application to continue.
191147

192148
h4. Configure ActionMailer
193149

194-
The example application is set to deliver email in both development and production. It will raise delivery errors in development but not production.
150+
The example application is set to deliver email in production only. It will raise delivery errors in development but not production.
195151

196152
In development, @config.action_mailer.default_url_options@ is set for a host at @localhost:3000@ which will enable links in Devise confirmation email messages to work properly. You'll need to change the @config.action_mailer.default_url_options@ host option from @example.com@ to your own domain for the production environment.
197153

198-
You can change these values as needed in the *config/environments/development.rb* and *config/environments/production.rb* files.
154+
You can change these values as needed in these two files:
155+
156+
* *config/environments/development.rb*
157+
* *config/environments/production.rb*
199158

200159
h4. Configure Devise for Email
201160

202161
Complete your email configuration by modifying
203162

204-
*config/initializers/devise.rb*
163+
* *config/initializers/devise.rb*
205164

206165
and setting the @config.mailer_sender@ option for the return email address for messages that Devise sends from the application.
207166

208167
h2. Configure Devise
209168

210169
You can modify the configuration file for Devise if you want to use something other than the defaults:
211170

212-
*config/initializers/devise.rb*
171+
* *config/initializers/devise.rb*
213172

214173
h2. Create a Default User
215174

216-
h4. Set Up a Database Seed File
175+
h3. Set Up a Database Seed File
217176

218177
You'll want to set up a default user so you can easily log in to test the app. You can modify the file *db/seeds.rb* for your own name, email and password:
219178

@@ -223,27 +182,28 @@ user = User.create! :name => 'First User', :email => '[email protected]', :passwo
223182
puts 'New user created: ' << user.name
224183
user2 = User.create! :name => 'Second User', :email => '[email protected]', :password => 'please', :password_confirmation => 'please'
225184
puts 'New user created: ' << user2.name
185+
user.add_role :admin
226186
</pre>
227187

228188
Use the defaults or change the values for name, email, and password as you wish.
229189

230-
If you've generated the application with the option to install the Devise @:confirmable@ module, there will be an extra attribute @confirmed_at => Time.now@ for creation of a user.
231-
232-
h4. Set the Database
190+
h3. Set the Database
233191

234192
Prepare the database and add the default user to the database by running the commands:
235193

236194
<pre>
237-
$ bundle exec rake db:migrate
238-
$ bundle exec rake db:seed
195+
$ rake db:migrate
196+
$ rake db:seed
239197
</pre>
240198

241199
Set the database for running tests:
242200

243201
<pre>
244-
$ bundle exec rake db:test:prepare
202+
$ rake db:test:prepare
245203
</pre>
246204

205+
If you’re not using "rvm":https://rvm.io/, the Ruby Version Manager, you should preface each rake command with @bundle exec@. You don’t need to use @bundle exec@ if you are using rvm version 1.11.0 or newer.
206+
247207
h2. Test the App
248208

249209
You can check that your app runs properly by entering the command
@@ -259,6 +219,8 @@ To sign in as the default user, (unless you've changed it) use
259219

260220
You should delete or change the pre-configured logins before you deploy your application.
261221

222+
If you test the app by starting the web server and then leave the server running while you install new gems, you’ll have to restart the server to see any changes. The same is true for changes to configuration files in the config folder. This can be confusing to new Rails developers because you can change files in the app folders without restarting the server. Stop the server each time after testing and you will avoid this issue.
223+
262224
h2. Deploy to Heroku
263225

264226
For your convenience, here is a "Tutorial for Rails on Heroku":http://railsapps.github.com/rails-heroku-tutorial.html. Heroku provides low cost, easily configured Rails application hosting.
@@ -291,7 +253,7 @@ Are you getting an error "OpenSSL certificate verify failed" when you try to gen
291253

292254
h2. Documentation and Support
293255

294-
This is the only documentation.
256+
The "tutorial":http://railsapps.github.com/tutorial-rails-devise-rspec-cucumber.html provides additional documentation.
295257

296258
For a Devise introduction, Ryan Bates offers a "Railscast on Devise":http://railscasts.com/episodes/209-introducing-devise. You can find documentation for "Devise":http://github.com/plataformatec/devise at "http://github.com/plataformatec/devise":http://github.com/plataformatec/devise. There is an active "Devise mailing list":http://groups.google.com/group/plataformatec-devise and you can submit "Devise issues":http://github.com/plataformatec/devise/issues at GitHub.
297259

@@ -315,7 +277,7 @@ If you add functionality to this application, create an alternative implementati
315277

316278
h2. Credits
317279

318-
Daniel Kehoe ("http://danielkehoe.com/":http://danielkehoe.com/) implemented the application and wrote the tutorial.
280+
Daniel Kehoe implemented the application and wrote the tutorial.
319281

320282
Is the app useful to you? Follow the project on Twitter: "@rails_apps":http://twitter.com/rails_apps
321283
and tweet some praise. I'd love to know you were helped out by what I've put together.

0 commit comments

Comments
 (0)