recipes/devise.rb in rails_apps_composer-1.1.4 vs recipes/devise.rb in rails_apps_composer-1.1.5
- old
+ new
@@ -1,21 +1,35 @@
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/devise.rb
-if config['devise']
- gem 'devise', '>= 2.0.4'
-else
- recipes.delete('devise')
+case config['devise']
+ when 'no'
+ recipes.delete('devise')
+ say_wizard "Devise recipe skipped."
+ when 'standard'
+ gem 'devise', '>= 2.0.4'
+ when 'confirmable'
+ gem 'devise', '>= 2.0.4'
+ recipes << 'devise-confirmable'
+ when 'invitable'
+ gem 'devise', '>= 2.0.4'
+ gem 'devise_invitable', '>= 1.0.0'
+ recipes << 'devise-confirmable'
+ recipes << 'devise-invitable'
+ else
+ recipes.delete('devise')
+ say_wizard "Devise recipe skipped."
end
-if config['devise']
+if recipes.include? 'devise'
after_bundler do
-
+
say_wizard "Devise recipe running 'after bundler'"
-
+
# Run the Devise generator
generate 'devise:install'
+ generate 'devise_invitable:install' if recipes.include? 'devise-invitable'
if recipes.include? 'mongo_mapper'
gem 'mm-devise'
gsub_file 'config/initializers/devise.rb', 'devise/orm/', 'devise/orm/mongo_mapper_active_model'
generate 'mongo_mapper:devise User'
@@ -30,11 +44,11 @@
if recipes.include? 'cucumber'
# Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path
# (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)
gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'
end
-
+
end
after_everything do
say_wizard "Devise recipe running 'after everything'"
@@ -73,7 +87,8 @@
category: authentication
exclusive: authentication
config:
- devise:
- type: boolean
- prompt: Would you like to use Devise for authentication?
\ No newline at end of file
+ type: multiple_choice
+ prompt: Would you like to use Devise for authentication?
+ choices: [["No", no], ["Devise with default modules", standard], ["Devise with Confirmable module", confirmable], ["Devise with Confirmable and Invitable modules", invitable]]