rails3_devise_wizard 0.2.8 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.textile CHANGED
@@ -71,7 +71,7 @@ $ rails3_devise_wizard new APP_NAME -r jquery haml
71
71
  To build the "rails3-mongoid-devise":http://github.com/fortuity/rails3-mongoid-devise/ example application, run the command:
72
72
 
73
73
  <pre>
74
- $ rails3_devise_wizard new APP_NAME -r 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 git
74
+ $ rails3_devise_wizard new APP_NAME -r jquery haml rspec cucumber mongoid action_mailer devise add_user home_page home_page_users seed_database users_page css_setup application_layout devise_navigation cleanup ban_spiders git
75
75
  </pre>
76
76
 
77
77
  h2. Make Your Own Starter App with a Reusable Application Template
@@ -100,33 +100,122 @@ The rails3_devise_wizard gem creates an application template as an intermediate
100
100
  $ rake print --silent RECIPES=recipe1,recipe2 > ~/Desktop/template.txt
101
101
  </pre>
102
102
 
103
- To build a reusable application template for the "rails3-mongoid-devise":http://github.com/fortuity/rails3-mongoid-devise/ example application, run the command:
103
+ If you don't include the @--silent@ option, the rake task will generate the application template with an extraneous first line. Open the template file and remove the first line if you encounter this problem.
104
+
105
+ 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
106
 
105
107
  <pre>
106
- $ rake print --silent RECIPES=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,git > ~/Desktop/template.txt
108
+ $ rails new testapp -m ~/Desktop/template.txt
107
109
  </pre>
108
110
 
109
- h4. Edit the Application Template
111
+ You can specify the @-T -O -J@ flags as needed to skip Test::Unit files, Active Record files, and Prototype files.
110
112
 
111
- If you don't include the @--silent@ option, the rake task will generate the application template with an extraneous first line. Open the template file and remove the first line if you encounter this problem.
113
+ That's all it takes. You'll have a ready-to-customize Rails web application in minutes.
112
114
 
113
- h4. Generate an Application from an Application Template
115
+ h4. Template for Rails 3 + Devise + RSpec + Cucumber
114
116
 
115
- The rails3_devise_wizard gem creates an application template that can be used by the @rails new@ command with the @-m@ option. For example:
117
+ To build a reusable application template for the "rails3-devise-rspec-cucumber":http://github.com/fortuity/rails3-devise-rspec-cucumber/ example application, run the command:
116
118
 
117
119
  <pre>
118
- $ rails new testapp -m ~/Desktop/template.txt
120
+ $ rake print --silent RECIPES=jquery,haml,rspec,cucumber,action_mailer,devise,add_user,home_page,home_page_users,seed_database,users_page,css_setup,application_layout,devise_navigation,cleanup,ban_spiders,git > ~/Desktop/template.txt
119
121
  </pre>
120
122
 
121
- You can specify the @-T -O -J@ flags as needed to skip Test::Unit files, Active Record files, and Prototype files.
123
+ Then generate the application using the @-T -J@ flags:
122
124
 
123
- Here's an example:
125
+ <pre>
126
+ $ rails new testapp -m ~/Desktop/template.txt -T -J
127
+ </pre>
128
+
129
+ h4. Template for Rails 3 + Mongoid + Devise
130
+
131
+ To build a reusable application template for the "rails3-mongoid-devise":http://github.com/fortuity/rails3-mongoid-devise/ example application, run the command:
124
132
 
125
133
  <pre>
126
- $ rails new testapp -m ~/Desktop/recipe.txt -T -O -J
134
+ $ rake print --silent RECIPES=jquery,haml,rspec,cucumber,mongoid,action_mailer,devise,add_user,home_page,home_page_users,seed_database,users_page,css_setup,application_layout,devise_navigation,cleanup,ban_spiders,git > ~/Desktop/template.txt
127
135
  </pre>
128
136
 
129
- That's all it takes. You'll have a ready-to-customize Rails web application in minutes.
137
+ Then generate the application using the @-T -O -J@ flags:
138
+
139
+ <pre>
140
+ $ rails new testapp -m ~/Desktop/template.txt -T -O -J
141
+ </pre>
142
+
143
+ h4. Template for Rails 3 + Mongoid + OmniAuth
144
+
145
+ To build a reusable application template for the "rails3-mongoid-omniauth":http://github.com/fortuity/rails3-mongoid-omniauth/ example application, run the command:
146
+
147
+ <pre>
148
+ $ rake print --silent RECIPES=jquery,haml,rspec,cucumber,mongoid,seed_database,add_user,omniauth,home_page,home_page_users,css_setup,application_layout,navigation,users_page,omniauth_email,cleanup,ban_spiders,git > ~/Desktop/template.txt
149
+ </pre>
150
+
151
+ Then generate the application using the @-T -O -J@ flags:
152
+
153
+ <pre>
154
+ $ rails new testapp -m ~/Desktop/template.txt -T -O -J
155
+ </pre>
156
+
157
+ h2. The Recipes
158
+
159
+ The following recipes are available.
160
+
161
+ h4. Recipes for General Use
162
+
163
+ |_. File |_. |_. Dependencies |_. Authors |
164
+ | "action_mailer.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/action_mailer.rb | Changes ActionMailer defaults | none | dkehoe |
165
+ | "ban_spiders.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/ban_spiders.rb | Ban spiders from your site by changing robots.txt | none | dkehoe |
166
+ | "cleanup.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/cleanup.rb | Remove unnecessary files, add READMEs | none | fnichol, dkehoe |
167
+ | "git.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/git.rb | Add a gitignore file, initialize new Git repo | Git | fnichol, dkehoe |
168
+ | "sample_readme.textile":https://github.com/fortuity/rails-template-recipes/raw/master/sample_readme.textile | Placeholder text for a README file (textile markup) | none | dkehoe |
169
+ | "sample_readme.txt":https://github.com/fortuity/rails-template-recipes/raw/master/sample_readme.txt | Placeholder text for a README file (ASCII) | none | dkehoe |
170
+
171
+ h4. Recipes for Testing and BDD
172
+
173
+ |_. File |_. |_. Dependencies |_. Authors |
174
+ | "rspec.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/rspec.rb | Install RSpec | none | rbrooker, dkehoe |
175
+ | "cucumber.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/cucumber.rb | Install Cucumber | none | rbrooker, dkehoe |
176
+
177
+ h4. Recipes for Mongoid
178
+
179
+ |_. File |_. |_. Dependencies |_. Authors |
180
+ | "mongoid.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/mongoid.rb | Installs Mongoid with the bson_ext gem | Mongoid | dkehoe |
181
+
182
+ h4. Recipes for jQuery
183
+
184
+ |_. File |_. |_. Dependencies |_. Authors |
185
+ | "jquery.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/jquery_fix.rb | Installs jQuery | none | dkehoe |
186
+
187
+ h4. Recipes for Devise
188
+
189
+ |_. File |_. |_. Dependencies |_. Authors |
190
+ | "devise.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/devise.rb | Installs Devise | none | dkehoe |
191
+
192
+ h4. Recipes for OmniAuth
193
+
194
+ |_. File |_. |_. Dependencies |_. Authors |
195
+ | "omniauth.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/omniauth.rb | OmniAuth for authentication | none | dkehoe |
196
+ | "omniauth_email.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/omniauth_email.rb | Requests a new uer's email address when authenticating with Twitter, etc. | OmniAuth | dkehoe |
197
+
198
+ h4. Recipes for Haml
199
+
200
+ |_. File |_. |_. Dependencies |_. Authors |
201
+ | "haml.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/haml.rb | Installs Haml | none | dkehoe |
202
+
203
+ h4. Recipes for the Application Layout
204
+
205
+ |_. File |_. |_. Dependencies |_. Authors |
206
+ | "application_layout.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/application_layout.rb | Adds application layout with flash messages | ERB or Haml | dkehoe |
207
+ | "css_setup.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/css_setup.rb | Add a stylesheet with styles for a horizontal menu and flash messages | none | dkehoe |
208
+
209
+ h4. Recipes for the Example Apps
210
+
211
+ |_. File |_. |_. Dependencies |_. Authors |
212
+ | "add_user.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/add_user.rb | adds User model for use with OmniAuth or Devise | none | dkehoe |
213
+ | "navigation.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/_navigation.rb | Add navigation links to the default application layout | none | dkehoe |
214
+ | "devise_navigation.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/devise_navigation.rb | Add navigation links to the default application layout | Devise | dkehoe |
215
+ | "home_page.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/home_page.rb | Create a home controller, route, and simple view | ERB or Haml | dkehoe |
216
+ | "home_page_users.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/home_page_users.rb | Modify a home page to display a list of users | Home controller, User model, ERB or Haml | dkehoe |
217
+ | "seed_database.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/seed_database.rb | Adds a db/seeds.rb file to initialize a database | none | dkehoe |
218
+ | "users_page.rb":https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/users_page.rb | Add a home page containing links to User pages | User model, ERB or Haml | dkehoe |
130
219
 
131
220
  h2. Writing New Recipes
132
221
 
data/recipes/cucumber.rb CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  if config['cucumber']
5
5
  gem 'cucumber-rails', ">= 0.4.1", :group => :test
6
- gem 'capybara', ">= 1.0.0.beta1", :group => :test
6
+ gem 'capybara', ">= 0.4.1.2", :group => :test
7
7
  gem 'database_cleaner', '>= 0.6.7', :group => :test
8
8
  gem 'launchy', ">= 0.4.0", :group => :test
9
9
  else
data/recipes/devise.rb CHANGED
@@ -35,20 +35,20 @@ if config['devise']
35
35
  say_wizard "Devise recipe running 'after everything'"
36
36
 
37
37
  if recipes.include? 'rspec'
38
- say_wizard "Copying RSpec files from the rails3-mongoid-devise examples"
39
- # copy all the RSpec specs files from the rails3-mongoid-devise example app
38
+ say_wizard "Copying RSpec files from the rails3-devise-rspec-cucumber examples"
39
+ # copy all the RSpec specs files from the rails3-devise-rspec-cucumber example app
40
40
  inside 'spec' do
41
- get 'https://github.com/fortuity/rails3-mongoid-devise/raw/master/spec/factories.rb', 'factories.rb'
41
+ get 'https://github.com/fortuity/rails3-devise-rspec-cucumber/raw/master/spec/factories.rb', 'factories.rb'
42
42
  end
43
43
  remove_file 'spec/controllers/home_controller_spec.rb'
44
44
  remove_file 'spec/controllers/users_controller_spec.rb'
45
45
  inside 'spec/controllers' do
46
- get 'https://github.com/fortuity/rails3-mongoid-devise/raw/master/spec/controllers/home_controller_spec.rb', 'home_controller_spec.rb'
47
- get 'https://github.com/fortuity/rails3-mongoid-devise/raw/master/spec/controllers/users_controller_spec.rb', 'users_controller_spec.rb'
46
+ get 'https://github.com/fortuity/rails3-devise-rspec-cucumber/raw/master/spec/controllers/home_controller_spec.rb', 'home_controller_spec.rb'
47
+ get 'https://github.com/fortuity/rails3-devise-rspec-cucumber/raw/master/spec/controllers/users_controller_spec.rb', 'users_controller_spec.rb'
48
48
  end
49
49
  remove_file 'spec/models/user_spec.rb'
50
50
  inside 'spec/models' do
51
- get 'https://github.com/fortuity/rails3-mongoid-devise/raw/master/spec/models/user_spec.rb', 'user_spec.rb'
51
+ get 'https://github.com/fortuity/rails3-devise-rspec-cucumber/raw/master/spec/models/user_spec.rb', 'user_spec.rb'
52
52
  end
53
53
  remove_file 'spec/views/home/index.html.erb_spec.rb'
54
54
  remove_file 'spec/views/home/index.html.haml_spec.rb'
data/recipes/git.rb CHANGED
@@ -2,10 +2,21 @@
2
2
  # https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/git.rb
3
3
 
4
4
  after_everything do
5
+
5
6
  say_wizard "Git recipe running 'after everything'"
7
+
6
8
  # Git should ignore some files
7
9
  remove_file '.gitignore'
8
10
  get "https://github.com/fortuity/rails3-gitignore/raw/master/gitignore.txt", ".gitignore"
11
+
12
+ if recipes.include? 'omniauth'
13
+ append_file '.gitignore' do <<-TXT
14
+ # keep OmniAuth service provider secrets out of the Git repo
15
+ config/initializers/omniauth.rb
16
+ TXT
17
+ end
18
+ end
19
+
9
20
  # Initialize new Git repo
10
21
  git :init
11
22
  git :add => '.'
data/recipes/jquery.rb CHANGED
@@ -2,41 +2,57 @@
2
2
  # https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/jquery.rb
3
3
 
4
4
  if config['jquery']
5
- say_wizard "REMINDER: When creating a Rails app using jQuery..."
6
- say_wizard "you should add the '-J' flag to 'rails new'"
7
- after_bundler do
8
- say_wizard "jQuery recipe running 'after bundler'"
9
- # remove the Prototype adapter file
10
- remove_file 'public/javascripts/rails.js'
11
- # remove the Prototype files (if they exist)
12
- remove_file 'public/javascripts/controls.js'
13
- remove_file 'public/javascripts/dragdrop.js'
14
- remove_file 'public/javascripts/effects.js'
15
- remove_file 'public/javascripts/prototype.js'
16
- # add jQuery files
17
- inside "public/javascripts" do
18
- get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "rails.js"
19
- get "http://code.jquery.com/jquery-1.6.min.js", "jquery.js"
5
+ if recipes.include? 'rails 3.0'
6
+ say_wizard "Replacing Prototype framework with jQuery for Rails 3.0."
7
+ after_bundler do
8
+ say_wizard "jQuery recipe running 'after bundler'"
9
+ # remove the Prototype adapter file
10
+ remove_file 'public/javascripts/rails.js'
11
+ # remove the Prototype files (if they exist)
12
+ remove_file 'public/javascripts/controls.js'
13
+ remove_file 'public/javascripts/dragdrop.js'
14
+ remove_file 'public/javascripts/effects.js'
15
+ remove_file 'public/javascripts/prototype.js'
16
+ # add jQuery files
17
+ inside "public/javascripts" do
18
+ get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "rails.js"
19
+ get "http://code.jquery.com/jquery-1.6.min.js", "jquery.js"
20
+ if config['ui']
21
+ get "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js", "jqueryui.js"
22
+ end
23
+ end
24
+ # adjust the Javascript defaults
25
+ # first uncomment "config.action_view.javascript_expansions"
26
+ gsub_file "config/application.rb", /# config.action_view.javascript_expansions/, "config.action_view.javascript_expansions"
27
+ # then add "jquery rails" if necessary
28
+ gsub_file "config/application.rb", /= \%w\(\)/, "%w(jquery rails)"
29
+ # finally change to "jquery jqueryui rails" if necessary
20
30
  if config['ui']
21
- get "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js", "jqueryui.js"
31
+ gsub_file "config/application.rb", /jquery rails/, "jquery jqueryui rails"
22
32
  end
23
33
  end
24
- # adjust the Javascript defaults
34
+ elsif recipes.include? 'rails 3.1'
25
35
  if config['ui']
26
- inject_into_file 'config/application.rb', "config.action_view.javascript_expansions[:defaults] = %w(jquery jqueryui rails)\n", :after => "config.action_view.javascript_expansions[:defaults] = %w()\n", :verbose => false
36
+ inside "app/assets/javascripts" do
37
+ get "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js", "jqueryui.js"
38
+ end
27
39
  else
28
- inject_into_file 'config/application.rb', "config.action_view.javascript_expansions[:defaults] = %w(jquery rails)\n", :after => "config.action_view.javascript_expansions[:defaults] = %w()\n", :verbose => false
29
- end
30
- gsub_file "config/application.rb", /config.action_view.javascript_expansions\[:defaults\] = \%w\(\)\n/, ""
40
+ say_wizard "jQuery installed by default in Rails 3.1."
41
+ end
42
+ else
43
+ say_wizard "Don't know what to do for Rails version #{Rails::VERSION::STRING}. jQuery recipe skipped."
31
44
  end
32
45
  else
46
+ if config['ui']
47
+ say_wizard "You said you didn't want jQuery. Can't install jQuery UI without jQuery."
48
+ end
33
49
  recipes.delete('jquery')
34
50
  end
35
51
 
36
52
  __END__
37
53
 
38
54
  name: jQuery
39
- description: "Use jQuery instead of Prototype."
55
+ description: "Install jQuery (with jQuery UI option) for Rails 3.0 or 3.1."
40
56
  author: fortuity
41
57
 
42
58
  exclusive: javascript_framework
@@ -48,7 +64,7 @@ args: ["-J"]
48
64
  config:
49
65
  - jquery:
50
66
  type: boolean
51
- prompt: Would you like to use jQuery instead of Prototype?
67
+ prompt: Would you like to use jQuery?
52
68
  - ui:
53
69
  type: boolean
54
70
  prompt: Would you like to use jQuery UI?
data/recipes/omniauth.rb CHANGED
@@ -9,84 +9,81 @@ end
9
9
 
10
10
  if config['omniauth']
11
11
  after_bundler do
12
-
13
- create_file 'config/initializers/omniauth.rb', <<-RUBY
12
+
13
+ # Don't use single-quote-style-heredoc: we want interpolation.
14
+ create_file 'config/initializers/omniauth.rb' do <<-RUBY
14
15
  Rails.application.config.middleware.use OmniAuth::Builder do
15
- provider :provider, 'KEY', 'SECRET'
16
+ provider :#{config['provider']}, 'KEY', 'SECRET'
16
17
  end
17
18
  RUBY
18
- end
19
+ end
19
20
 
20
- append_file '.gitignore' do <<-TXT
21
- \n
22
- # keep OmniAuth service provider secrets out of the Git repo
23
- config/initializers/omniauth.rb
24
- TXT
25
- end
21
+ route "match '/auth/failure' => 'sessions#failure'"
22
+ route "match '/signout' => 'sessions#destroy', :as => :signout"
23
+ route "match '/signin' => 'sessions#new', :as => :signin"
24
+ route "match '/auth/:provider/callback' => 'sessions#create'"
25
+ route "resources :users, :only => [ :show, :edit, :update ]"
26
+
27
+ inject_into_file 'app/models/user.rb', :before => 'end' do <<-RUBY
26
28
 
27
- inject_into_file 'config/routes.rb', :before => 'end' do
28
- "resources :users, :only => [ :show, :edit, :update ]\n"
29
- end
30
- inject_into_file 'config/routes.rb', :before => 'end' do
31
- "match '/auth/:provider/callback' => 'sessions#create'\n"
32
- end
33
- inject_into_file 'config/routes.rb', :before => 'end' do
34
- "match '/signout' => 'sessions#destroy', :as => :signout\n"
35
- end
36
- inject_into_file 'config/routes.rb', :before => 'end' do
37
- "match '/signin' => 'sessions#new', :as => :signin\n"
38
- end
39
- inject_into_file 'config/routes.rb', :before => 'end' do
40
- "match '/auth/failure' => 'sessions#failure'\n"
41
- end
42
-
43
- inject_into_file 'app/models/user.rb', :before => 'end' do <<-RUBY
44
29
  def self.create_with_omniauth(auth)
45
- create! do |user|
46
- user.provider = auth['provider']
47
- user.uid = auth['uid']
48
- user.name = auth['user_info']['name'] if auth['user_info']['name'] # Twitter, Google, Yahoo, GitHub
49
- user.email = auth['user_info']['email'] if auth['user_info']['email'] # Google, Yahoo, GitHub
50
- user.name = auth['extra']['user_hash']['name'] if auth['extra']['user_hash']['name'] # Facebook
51
- user.email = auth['extra']['user_hash']['email'] if auth['extra']['user_hash']['email'] # Facebook
30
+ begin
31
+ create! do |user|
32
+ user.provider = auth['provider']
33
+ user.uid = auth['uid']
34
+ if auth['user_info']
35
+ user.name = auth['user_info']['name'] if auth['user_info']['name'] # Twitter, Google, Yahoo, GitHub
36
+ user.email = auth['user_info']['email'] if auth['user_info']['email'] # Google, Yahoo, GitHub
37
+ end
38
+ if auth['extra']['user_hash']
39
+ user.name = auth['extra']['user_hash']['name'] if auth['extra']['user_hash']['name'] # Facebook
40
+ user.email = auth['extra']['user_hash']['email'] if auth['extra']['user_hash']['email'] # Facebook
41
+ end
42
+ end
43
+ rescue Exception
44
+ raise Exception, "cannot create user record"
52
45
  end
53
46
  end
47
+
54
48
  RUBY
55
- end
49
+ end
56
50
 
57
- create_file 'app/controllers/sessions_controller.rb', <<-RUBY
51
+ # We have to use single-quote-style-heredoc to avoid interpolation.
52
+ create_file 'app/controllers/sessions_controller.rb', do <<-'RUBY'
58
53
  class SessionsController < ApplicationController
59
-
60
- def new
61
- redirect_to '/auth/provider}'
62
- end
63
-
54
+
64
55
  def create
65
56
  auth = request.env["omniauth.auth"]
66
57
  user = User.where(:provider => auth['provider'],
67
58
  :uid => auth['uid']).first || User.create_with_omniauth(auth)
68
59
  session[:user_id] = user.id
69
- if !user.email
70
- redirect_to edit_user_path(user), :alert => "Please enter your email address."
71
- else
72
- redirect_to root_url, :notice => 'Signed in!'
73
- end
60
+ redirect_to root_url, :notice => 'Signed in!'
74
61
  end
75
-
62
+
76
63
  def destroy
77
64
  session[:user_id] = nil
78
65
  redirect_to root_url, :notice => 'Signed out!'
79
66
  end
80
-
67
+
81
68
  def failure
82
69
  redirect_to root_url, :alert => "Authentication error: #{params[:message].humanize}"
83
70
  end
84
-
71
+
85
72
  end
86
73
  RUBY
87
- end
74
+ end
75
+
76
+ # Don't use single-quote-style-heredoc: we want interpolation.
77
+ inject_into_class 'app/controllers/sessions_controller.rb', 'SessionsController' do <<-RUBY
78
+
79
+ def new
80
+ redirect_to '/auth/#{config['provider']}'
81
+ end
82
+
83
+ RUBY
84
+ end
88
85
 
89
- inject_into_file 'app/controllers/application_controller.rb', :before => 'end' do <<-RUBY
86
+ inject_into_file 'app/controllers/application_controller.rb', :before => 'end' do <<-RUBY
90
87
  helper_method :current_user
91
88
  helper_method :user_signed_in?
92
89
  helper_method :correct_user?
@@ -116,8 +113,9 @@ RUBY
116
113
  redirect_to root_url, :alert => 'You need to sign in for access to this page.'
117
114
  end
118
115
  end
116
+
119
117
  RUBY
120
- end
118
+ end
121
119
 
122
120
  end
123
121
  end
@@ -9,11 +9,11 @@ after_bundler do
9
9
  # Modify a users controller
10
10
  #----------------------------------------------------------------------------
11
11
  inject_into_file 'app/controllers/users_controller.rb', :after => "before_filter :authenticate_user!\n" do <<-RUBY
12
- before_filter :correct_user?\n
12
+ before_filter :correct_user?
13
13
  RUBY
14
14
  end
15
15
 
16
- inject_into_file 'app/controllers/users_controller.rb', :before => 'end' do <<-RUBY
16
+ inject_into_file 'app/controllers/users_controller.rb', :before => 'def show' do <<-RUBY
17
17
  def edit
18
18
  @user = User.find(params[:id])
19
19
  end
@@ -26,6 +26,7 @@ RUBY
26
26
  render :edit
27
27
  end
28
28
  end
29
+ \n
29
30
  RUBY
30
31
  end
31
32
 
@@ -62,10 +63,10 @@ ERB
62
63
  gsub_file 'app/controllers/sessions_controller.rb', /redirect_to root_url, :notice => 'Signed in!'/ do
63
64
  <<-RUBY
64
65
  if !user.email
65
- redirect_to edit_user_path(user), :alert => "Please enter your email address."
66
- else
67
- redirect_to root_url, :notice => 'Signed in!'
68
- end
66
+ redirect_to edit_user_path(user), :alert => "Please enter your email address."
67
+ else
68
+ redirect_to root_url, :notice => 'Signed in!'
69
+ end
69
70
  RUBY
70
71
  end
71
72
 
data/recipes/rspec.rb CHANGED
@@ -25,16 +25,28 @@ if config['rspec']
25
25
  after_bundler do
26
26
  say_wizard "RSpec recipe running 'after bundler'"
27
27
  generate 'rspec:install'
28
-
28
+
29
29
  say_wizard "Removing test folder (not needed for RSpec)"
30
30
  run 'rm -rf test/'
31
31
 
32
+ inject_into_file 'config/application.rb', :after => "Rails::Application\n" do <<-RUBY
33
+
34
+ # don't generate RSpec tests for views and helpers
35
+ config.generators do |g|
36
+ g.view_specs false
37
+ g.helper_specs false
38
+ end
39
+
40
+ RUBY
41
+ end
42
+
43
+
32
44
  if recipes.include? 'mongoid'
33
-
45
+
34
46
  # remove ActiveRecord artifacts
35
47
  gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'
36
48
  gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'
37
-
49
+
38
50
  # reset your application database to a pristine state during testing
39
51
  inject_into_file 'spec/spec_helper.rb', :before => "\nend" do
40
52
  <<-RUBY
data/templates/layout.erb CHANGED
@@ -20,11 +20,28 @@ Rails.application.config.generators do |g|
20
20
  end
21
21
  RUBY
22
22
 
23
- @recipes = <%= resolve_recipes.map(&:key).inspect %>
23
+ @recipes = <%= resolve_recipes.map(&:key).inspect %>
24
24
 
25
25
  <%= render "helpers" %>
26
26
 
27
+ case Rails::VERSION::MAJOR.to_s
28
+ when "3"
29
+ case Rails::VERSION::MINOR.to_s
30
+ when "1"
31
+ say_wizard "You are using Rails version #{Rails::VERSION::STRING}."
32
+ @recipes << 'rails 3.1'
33
+ when "0"
34
+ say_wizard "You are using Rails version #{Rails::VERSION::STRING}."
35
+ @recipes << 'rails 3.0'
36
+ else
37
+ say_wizard "You are using Rails version #{Rails::VERSION::STRING} which is not supported."
38
+ end
39
+ else
40
+ say_wizard "You are using Rails version #{Rails::VERSION::STRING} which is not supported."
41
+ end
42
+
27
43
  say_wizard "Checking configuration. Please confirm your preferences."
44
+
28
45
  <% resolve_recipes.each do |recipe| %>
29
46
  <%= render 'recipe', recipe.get_binding %>
30
47
  <% end %>
@@ -49,4 +66,4 @@ say_wizard "Running 'after everything' callbacks."
49
66
  @current_recipe = nil
50
67
  say_wizard "Finished running the rails3_devise_wizard app template."
51
68
  say_wizard "Your new Rails app is ready. Any problems?"
52
- say_wizard "See http://github.com/fortuity/rails3-mongoid-devise/issues"
69
+ say_wizard "See http://github.com/fortuity/rails3_devise_wizard/issues"
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RailsWizard
2
- VERSION = "0.2.8"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rails3_devise_wizard
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.8
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Kehoe
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-05 00:00:00 Z
13
+ date: 2011-05-13 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
@@ -175,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - ">="
177
177
  - !ruby/object:Gem::Version
178
- hash: -2109356593565776162
178
+ hash: 2176637839049336499
179
179
  segments:
180
180
  - 0
181
181
  version: "0"
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
186
186
  - !ruby/object:Gem::Version
187
- hash: -2109356593565776162
187
+ hash: 2176637839049336499
188
188
  segments:
189
189
  - 0
190
190
  version: "0"