Sha256: 77dd706c755a6fd7f0ff6283b9c777c3957181b87d6b59e7d1eaa44841d8a312

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

require 'rails/generators/base'

module Authenticate
  module Generators
    class RoutesGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)

      def add_authenticate_routes
        route(authenticate_routes)
      end

      def disable_authenticate_internal_routes
        inject_into_file(
          'config/initializers/authenticate.rb',
          "  config.routes = false \n",
          after: "Authenticate.configure do |config|\n",
        )
      end

      private

      def authenticate_routes
        File.read(routes_file_path)
      end

      def routes_file_path
        File.expand_path(find_in_source_paths('routes.rb'))
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authenticate-0.2.1 lib/generators/authenticate/routes/routes_generator.rb
authenticate-0.2.0 lib/generators/authenticate/routes/routes_generator.rb