Module: Stationed::Generators::Plugins::Devise

Included in:
AppGenerator
Defined in:
lib/stationed/generators/plugins/devise.rb

Instance Method Summary collapse

Instance Method Details

#finish_templateObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/stationed/generators/plugins/devise.rb', line 5

def finish_template
  gem 'devise'
  copy_file 'devise.rb', 'spec/support/devise.rb'
  route "devise_scope :user do\n    root to: 'devise/sessions#new'\n  end\n"
  environment nil, env: :test do
    "config.action_mailer.default_url_options = { host: 'example.com' }"
  end
  environment nil, env: :development do
    "config.action_mailer.default_url_options = { host: 'localhost:3000' }"
  end
  super
end

#run_bundleObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/stationed/generators/plugins/devise.rb', line 18

def run_bundle
  super
  generate 'devise:install'
  generate 'devise user'
  application do
    <<-RUBY
# Let Pundit authorization or custom responders not influence the workings
    # of Devise.
    config.to_prepare do
      [
Devise::SessionsController,
Devise::RegistrationsController,
Devise::PasswordsController
      ].each do |devise_controller_class|
devise_controller_class.skip_after_action :verify_authorized
devise_controller_class.skip_after_action :verify_policy_scoped
devise_controller_class.responder = ActionController::Responder
      end
    end
    RUBY
  end
end