Sha256: cf472b5286547259e0a3464f649e6d4ee10353792a17bc789559ebac769a69c5

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents

require "rails/generators/base"

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

      def inject_duodealer_app_routes_into_application_routes
        route(session_routes)
      end

      def disable_engine_routes
        gsub_file(
          "config/routes.rb",
          "mount DuodealerApp::Engine, at: '/'",
          ""
        )
      end

      private
        def session_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

3 entries across 3 versions & 1 rubygems

Version Path
duodealer_app-1.0.4 lib/generators/duodealer_app/routes/routes_generator.rb
duodealer_app-1.0.3 lib/generators/duodealer_app/routes/routes_generator.rb
duodealer_app-1.0.2 lib/generators/duodealer_app/routes/routes_generator.rb