Sha256: a45e764bdb710109c7747fcef4276ab7938d15ad012f572321f5a90facb8e7c3

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

authentication_framework = {
  devise: ->{
    gather_gem 'devise'

    after(:gem_install) do
      generate "devise:install"

      if auth_model = get(:authentication_model)
        generate "devise #{auth_model.to_s}"
      end

      gsub_file "config/initializers/devise.rb", /(\# config.secret_key.+)/i do |match|
        match = "config.secret_key = ENV['DEVISE_SECRET_KEY']"
      end

      gsub_file "config/initializers/devise.rb", /(config.mailer_sender.+)/i do |match|
        match = "config.mailer_sender = ENV['DEFAULT_EMAIL_ADDRESS']"
      end

      append_to_file '.rbenv-vars.example', 'DEVISE_SECRET_KEY='
    end
  }
}

if get(:authentication)
  instance_exec(&(authentication_framework[get(:authentication)] || ->{ }))
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
potassium-1.0.1 lib/potassium/templates/application/recipes/devise.rb
potassium-1.0.0 lib/potassium/templates/application/recipes/devise.rb