Sha256: 7cde2b18aea74154eef384ffe603fad2956a0169241f5c7195f1858f86cd0fe6

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

module Auther
  # Install generator for adding Auther support to existing application.
  class InstallGenerator < ::Rails::Generators::Base
    source_root File.join(File.dirname(__FILE__), "..", "templates")

    desc "Installs Auther settings and routes."
    def install
      install_initializer
      add_routes
    end

    private

    def install_initializer
      template File.join("config", "initializers", "auther.rb"), File.join("config", "initializers", "auther.rb")
    end

    def add_routes
      route %(delete "/logout", to: "auther/session#destroy", as: "logout")
      route %(get "/login", to: "auther/session#new", as: "login")
      route %(mount Auther::Engine => "/auther")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
auther-6.1.0 lib/generators/auther/install/install_generator.rb
auther-6.0.0 lib/generators/auther/install/install_generator.rb