Sha256: 55df91eca5d441df88d4df74f6fc45f4e5fc6651ee5c2e930666002fd8c11323

Contents?: true

Size: 783 Bytes

Versions: 5

Compression:

Stored size: 783 Bytes

Contents

module NoPassword
  class InstallGenerator < Rails::Generators::Base
    source_root File.expand_path("../templates", __FILE__)

    def create_initializer_file
      template "config/initializers/no_password.rb"
    end

    def add_route
      return if Rails.application.routes.routes.detect { |route| route.app.app == NoPassword::Engine }
      route %(mount NoPassword::Engine => "/p")
    end

    def add_concerns
      inject_into_file "app/controllers/application_controller.rb", after: "ActionController::Base" do
        <<~EOF
          \n  include NoPassword::ControllerHelpers
        EOF
      end
    end

    def copy_migrations
      rake "no_password:install:migrations"
    end

    def build_tailwind
      rake "no_password:tailwindcss:build"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
no_password_auth-0.5.0 lib/generators/no_password/install_generator.rb
no_password_auth-0.4.1 lib/generators/no_password/install_generator.rb
no_password_auth-0.4.0 lib/generators/no_password/install_generator.rb
no_password_auth-0.3.0 lib/generators/no_password/install_generator.rb
no_password_auth-0.2.1 lib/generators/no_password/install_generator.rb