Sha256: 8c9b6f68633da96e8f96fcdc56e5475e2de6203534692a9d683870161be34109

Contents?: true

Size: 666 Bytes

Versions: 6

Compression:

Stored size: 666 Bytes

Contents

require 'rails/generators/base'

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

      def inject_spiffy_stores_app_routes_into_application_routes
        route(session_routes)
      end

      def disable_engine_routes
        gsub_file(
          'config/routes.rb',
          "mount SpiffyStoresApp::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

6 entries across 6 versions & 1 rubygems

Version Path
spiffy_stores_app-8.2.11 lib/generators/spiffy_stores_app/routes/routes_generator.rb
spiffy_stores_app-8.2.10 lib/generators/spiffy_stores_app/routes/routes_generator.rb
spiffy_stores_app-8.2.9 lib/generators/spiffy_stores_app/routes/routes_generator.rb
spiffy_stores_app-8.2.8 lib/generators/spiffy_stores_app/routes/routes_generator.rb
spiffy_stores_app-8.2.7 lib/generators/spiffy_stores_app/routes/routes_generator.rb
spiffy_stores_app-8.2.6 lib/generators/spiffy_stores_app/routes/routes_generator.rb