rails3_devise_wizard 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +97 -28
- data/recipes/devise.rb +23 -0
- data/version.rb +1 -1
- metadata +3 -3
data/README.textile
CHANGED
@@ -1,16 +1,24 @@
|
|
1
1
|
h1. Rails3 Devise Wizard Gem
|
2
2
|
|
3
|
-
|
3
|
+
Creates a ready-to-run Rails web application using Devise for authentication. Makes it easy to create and maintain a starter app using your own preferred options. This is the gem used to create the "rails3-mongoid-devise":http://github.com/fortuity/rails3-mongoid-devise/ example application, as described in a detailed "tutorial":http://github.com/fortuity/rails3-mongoid-devise/wiki/Tutorial-%28Walkthrough%29.
|
4
4
|
|
5
|
-
|
5
|
+
h4. Based on Michael Bleigh's RailsWizard Gem
|
6
6
|
|
7
|
-
|
7
|
+
The rails3_devise_wizard gem is a fork of "Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard (see credits below). The purpose of this fork is to provide recipes for a ready-to-run Rails web application that uses Devise for authentication. Several recipes provided by the rails3_devise_wizard gem are different from those provided by the rails_wizard gem. Applications generated with the rails3_devise_wizard gem are more complete; for example, they may include a home page with sign-in, sign-out navigation links.
|
8
8
|
|
9
|
-
|
9
|
+
h2. Suggested Use
|
10
|
+
|
11
|
+
Any developer can quickly generate a Rails web application using the @rails new@ command. In practice, experienced Rails developers typically add an assortment of useful additional packages (gems) before beginning development of any web application. A developer often uses the same set of packages to get started and may create a "starter app" that can be copied and reused for any new project.
|
12
|
+
|
13
|
+
It can be a hassle to integrate some of the most commonly used packages, particularly when new versions are released and there are minor "gotchas" that interfere with packages working together. Despite the apparent convenience of creating a starter app, it can be time consuming to maintain and update a starter app as component packages evolve. This project aims to simplify the process of building and maintaining a starter app by providing mix-and-match recipes to assemble the most commonly used Rails packages.
|
14
|
+
|
15
|
+
If you use this gem to create your Rails starter app, you can expect the pieces to work together. If they don't, you can report problems and look for identified "issues":http://github.com/fortuity/rails3_devise_wizard/issues (and perhaps contributed fixes).
|
16
|
+
|
17
|
+
If you use this gem to create a reusable application template (see the instructions below), you can check for changes to recipes here and reassemble your application template as packages evolve.
|
10
18
|
|
11
19
|
h2. Dependencies
|
12
20
|
|
13
|
-
Before generating a new Rails app
|
21
|
+
Before generating a new Rails app, you will need:
|
14
22
|
|
15
23
|
* The Ruby language (version 1.8.7 or 1.9.2)
|
16
24
|
* Rails (version 3.0.4 or newer)
|
@@ -28,44 +36,93 @@ h2. Installation
|
|
28
36
|
|
29
37
|
Installation is simple:
|
30
38
|
|
31
|
-
|
32
|
-
|
39
|
+
@$ gem install rails3_devise_wizard@
|
33
40
|
|
34
41
|
h2. Usage
|
35
42
|
|
36
|
-
|
43
|
+
h4. List Recipes
|
44
|
+
|
45
|
+
You can display a list of recipes:
|
46
|
+
|
47
|
+
@$ rails3_devise_wizard list@
|
48
|
+
|
49
|
+
You'll find more details about the available recipes by browsing the repository "recipes directory":https://github.com/fortuity/rails3_devise_wizard/tree/master/recipes.
|
50
|
+
|
51
|
+
h4. Generate a Starter App
|
52
|
+
|
53
|
+
You can build an application by providing a list of recipes with the @-r@ option. For example, to build the "rails3-mongoid-devise":http://github.com/fortuity/rails3-mongoid-devise/ example application, run the command:
|
54
|
+
|
55
|
+
<pre>
|
56
|
+
$ rails3_devise_wizard new APP_NAME -r git jquery haml rspec cucumber mongoid action_mailer devise add_user_name home_page home_page_users seed_database users_page css_setup application_layout devise_navigation cleanup ban_spiders
|
57
|
+
</pre>
|
58
|
+
|
59
|
+
This will automatically generate an application using the specified recipes.
|
60
|
+
|
61
|
+
h2. Make Your Own Starter App (the Easy Way)
|
62
|
+
|
63
|
+
h4. Select Recipes
|
64
|
+
|
65
|
+
You can mix and match recipes to create your own customized starter app. Browse the repository "recipes directory":https://github.com/fortuity/rails3_devise_wizard/tree/master/recipes to see what is available. Then provide your list of recipes to the rails3_devise_wizard gem using the @-r@ option and generate an app as needed. Here's an example that creates a simple app using jquery and haml:
|
66
|
+
|
67
|
+
<pre>
|
68
|
+
$ rails3_devise_wizard new APP_NAME -r jquery haml
|
69
|
+
</pre>
|
70
|
+
|
71
|
+
h2. Make Your Own Starter App (the Advanced Way)
|
37
72
|
|
38
|
-
|
73
|
+
You can modify the recipes and save an application template that creates your own customized starter app.
|
39
74
|
|
75
|
+
First, you'll need to make your own copy of the rails3_devise_wizard gem.
|
40
76
|
|
41
|
-
|
77
|
+
@$ git clone git://github.com/fortuity/rails3_devise_wizard.git@
|
42
78
|
|
43
|
-
|
79
|
+
@$ cd rails3_devise_wizard@
|
44
80
|
|
45
|
-
|
81
|
+
Install the "mg":https://github.com/sr/mg "minimal gem" which is required for development of the rails3_devise_wizard gem:
|
46
82
|
|
47
|
-
|
83
|
+
@$ gem install mg@
|
48
84
|
|
85
|
+
h4. Customize the Recipes
|
49
86
|
|
50
|
-
|
87
|
+
Modify or write new recipes as you wish (see below for details about writing recipes). You can run @rake spec@ to make sure your recipes conform to the required syntax.
|
51
88
|
|
52
|
-
h4.
|
89
|
+
h4. Save the Application Template
|
53
90
|
|
54
|
-
You can
|
91
|
+
The rails3_devise_wizard gem creates an application template as an intermediate step before generating an application. You can generate and save the application template. Here's an example of generating an application template and saving the template to a file:
|
55
92
|
|
56
|
-
|
93
|
+
<pre>
|
94
|
+
$ rake print RECIPES=recipe1,recipe2 > ~/Desktop/template.txt
|
95
|
+
</pre>
|
96
|
+
|
97
|
+
h4. Edit the Application Template
|
57
98
|
|
99
|
+
The application template is generated with an extraneous first line. Open the template file and remove the first line if it doesn't begin with a comment.
|
58
100
|
|
59
|
-
|
101
|
+
h4. Generate an Application from an Application Template
|
60
102
|
|
61
|
-
|
103
|
+
The rails3_devise_wizard gem creates an application template that can be used by the @rails new@ command with the @-m@ option. For example:
|
104
|
+
|
105
|
+
<pre>
|
106
|
+
$ rails new testapp -m ~/Desktop/template.txt
|
107
|
+
</pre>
|
108
|
+
|
109
|
+
You can specify the @-T -O -J@ flags as needed to skip Test::Unit files, Active Record files, and Prototype files.
|
110
|
+
|
111
|
+
Here's an example:
|
112
|
+
|
113
|
+
<pre>
|
114
|
+
$ rails new testapp -m ~/Desktop/recipe.txt -T -O -J
|
115
|
+
</pre>
|
62
116
|
|
117
|
+
That's all it takes. You'll have a ready-to-customize Rails web application in minutes.
|
63
118
|
|
64
|
-
h2.
|
119
|
+
h2. Writing New Recipes
|
65
120
|
|
66
|
-
You can find the rails3_devise_wizard recipe collection in the GitHub repository's "recipes directory":https://github.com/fortuity/rails3_devise_wizard/tree/master/recipes. If you find errors or
|
121
|
+
You can find the rails3_devise_wizard recipe collection in the GitHub repository's "recipes directory":https://github.com/fortuity/rails3_devise_wizard/tree/master/recipes. If you find errors or improve a recipe you can contribute to the project by submitting a pull request or creating a "Github issue":http://github.com/fortuity/rails3_devise_wizard/issues.
|
67
122
|
|
68
|
-
h4.
|
123
|
+
h4. Rails Wizard Basics
|
124
|
+
|
125
|
+
For more information on all available options for authoring recipes that can be read by the rails_wizard or rails3_devise_wizard gems, please see the "wiki for Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard/wiki.
|
69
126
|
|
70
127
|
Recipes are made of up *template code* and *YAML back-matter* stored in a ruby file. The @__END__@ parsing convention is used so that each recipe is actually a valid, parseable Ruby file. The structure of a recipe looks something like this:
|
71
128
|
|
@@ -84,11 +141,25 @@ description: Installs SuperGem which is useful for things
|
|
84
141
|
author: mbleigh
|
85
142
|
</pre>
|
86
143
|
|
87
|
-
|
144
|
+
h4. Rails3 Devise Wizard Differences
|
145
|
+
|
146
|
+
The rails3_devise_wizard gem is very similar to the rails_wizard gem, with one significant difference. The rails_wizard gem allows specification of execution order for recipes with @run_after@ and @run_after@ configuration flags. The rails3_devise_wizard gem does not support @run_after@ or @run_after@; instead, the order which you provide the recipes sets the execution order. This makes it easier to chain a series of recipes in the order you prefer. For example,
|
147
|
+
|
148
|
+
<pre>
|
149
|
+
$ rails3_devise_wizard new APP_NAME -r git jquery haml
|
150
|
+
</pre>
|
151
|
+
|
152
|
+
installs jquery before haml.
|
153
|
+
|
154
|
+
h4. Recipe Differences
|
155
|
+
|
156
|
+
Several recipes provided by the rails3_devise_wizard gem are different from those provided by the rails_wizard gem.
|
88
157
|
|
89
|
-
|
158
|
+
h4. Rails Wizard RSpec Tests
|
90
159
|
|
91
|
-
|
160
|
+
The gem has RSpec tests that automatically validate each recipe in the repository, so you should run @rake spec@ as a basic syntax check. Note that these don't verify that your recipe code itself works, just that the gem could properly parse and understand your recipe file.
|
161
|
+
|
162
|
+
h4. How It Works
|
92
163
|
|
93
164
|
Rails generators can use any methods provided by the "Thor::Actions":http://rdoc.info/github/wycats/thor/master/Thor/Actions module. The flexibility of mixing "recipes" for application templates comes from use of the @apply@ method from the Thor::Actions module. Given a web address or a local filepath, the "apply method":http://rdoc.info/github/wycats/thor/master/Thor/Actions#apply-instance_method loads and executes a file within the context of the generator script.
|
94
165
|
|
@@ -100,8 +171,6 @@ h4. Writing Recipes
|
|
100
171
|
|
101
172
|
To understand the code in these templates, take a look at "Thor::Actions":http://rdoc.info/github/wycats/thor/master/Thor/Actions. Your recipes can use any methods provided by "Thor::Actions":http://rdoc.info/github/wycats/thor/master/Thor/Actions or "Rails::Generators::Actions":http://railsapi.com/doc/rails-v3.0.3/classes/Rails/Generators/Actions.html.
|
102
173
|
|
103
|
-
Please send a message (via GitHub) or a "pull request" if you've written recipes you'd like to contribute.
|
104
|
-
|
105
174
|
h4. About Rails Application Templates
|
106
175
|
|
107
176
|
"Cooking Up A Custom Rails 3 Template (11 Oct 2010) by Andrea Singh":http://blog.madebydna.com/all/code/2010/10/11/cooking-up-a-custom-rails3-template.html
|
@@ -122,7 +191,7 @@ This project is based on "Michael Bleigh's RailsWizard gem":https://github.com/i
|
|
122
191
|
|
123
192
|
RSpec, Cucumber, and Yard recipes were contributed by "Ramon Brooker":http://cogniton-mind.tumblr.com/.
|
124
193
|
|
125
|
-
Additional recipes by
|
194
|
+
Additional recipes by Daniel Kehoe, "http://danielkehoe.com/":http://danielkehoe.com/, to implement the "rails3-mongoid-devise":http://github.com/fortuity/rails3-mongoid-devise/ example application.
|
126
195
|
|
127
196
|
Is the gem useful to you? Follow me on Twitter:
|
128
197
|
"http://twitter.com/railsinit":http://twitter.com/railsinit
|
data/recipes/devise.rb
CHANGED
@@ -23,6 +23,29 @@ after_bundler do
|
|
23
23
|
# Generate models and routes for a User
|
24
24
|
generate 'devise user'
|
25
25
|
|
26
|
+
if recipes.include? 'rspec'
|
27
|
+
# copy all the RSpec specs files from the rails3-mongoid-devise example app
|
28
|
+
inside 'spec' do
|
29
|
+
get 'https://github.com/fortuity/rails3-mongoid-devise/raw/master/spec/factories.rb', 'factories.rb'
|
30
|
+
end
|
31
|
+
remove_file 'spec/controllers/home_controller_spec.rb'
|
32
|
+
remove_file 'spec/controllers/users_controller_spec.rb'
|
33
|
+
inside 'spec/controllers' do
|
34
|
+
get 'https://github.com/fortuity/rails3-mongoid-devise/raw/master/spec/controllers/home_controller_spec.rb', 'home_controller_spec.rb'
|
35
|
+
get 'https://github.com/fortuity/rails3-mongoid-devise/raw/master/spec/controllers/users_controller_spec.rb', 'users_controller_spec.rb'
|
36
|
+
end
|
37
|
+
remove_file 'spec/models/user_spec.rb'
|
38
|
+
inside 'spec/models' do
|
39
|
+
get 'https://github.com/fortuity/rails3-mongoid-devise/raw/master/spec/models/user_spec.rb', 'user_spec.rb'
|
40
|
+
end
|
41
|
+
remove_file 'spec/views/home/index.html.erb_spec.rb'
|
42
|
+
remove_file 'spec/views/home/index.html.haml_spec.rb'
|
43
|
+
remove_file 'spec/views/users/show.html.erb_spec.rb'
|
44
|
+
remove_file 'spec/views/users/show.html.haml_spec.rb'
|
45
|
+
remove_file 'spec/helpers/home_helper_spec.rb'
|
46
|
+
remove_file 'spec/helpers/users_helper_spec.rb'
|
47
|
+
end
|
48
|
+
|
26
49
|
end
|
27
50
|
|
28
51
|
__END__
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rails3_devise_wizard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 0.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Daniel Kehoe
|
@@ -174,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
174
|
requirements:
|
175
175
|
- - ">="
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
hash: -
|
177
|
+
hash: -448456634312592260
|
178
178
|
segments:
|
179
179
|
- 0
|
180
180
|
version: "0"
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
requirements:
|
184
184
|
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
hash: -
|
186
|
+
hash: -448456634312592260
|
187
187
|
segments:
|
188
188
|
- 0
|
189
189
|
version: "0"
|