Sha256: 94e5b8d3140516046c79ef6b7be228db9cbb93470c9d17b567e8f39b9713f34a

Contents?: true

Size: 699 Bytes

Versions: 12

Compression:

Stored size: 699 Bytes

Contents

require 'rails/generators/base'

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

      def add_invitation_routes
        route(invitation_routes)
      end

      def disable_invitation_internal_routes
        inject_into_file(
          'config/initializers/invitation.rb',
          "  config.routes = false \n",
          after: "Invitation.configure do |config|\n"
        )
      end

      private

      def invitation_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

12 entries across 12 versions & 1 rubygems

Version Path
invitation-0.6.1 lib/generators/invitation/routes/routes_generator.rb
invitation-0.6.0 lib/generators/invitation/routes/routes_generator.rb
invitation-0.5.1 lib/generators/invitation/routes/routes_generator.rb
invitation-0.5.0 lib/generators/invitation/routes/routes_generator.rb
invitation-0.4.5 lib/generators/invitation/routes/routes_generator.rb
invitation-0.4.4 lib/generators/invitation/routes/routes_generator.rb
invitation-0.4.3 lib/generators/invitation/routes/routes_generator.rb
invitation-0.4.2 lib/generators/invitation/routes/routes_generator.rb
invitation-0.4.1 lib/generators/invitation/routes/routes_generator.rb
invitation-0.4 lib/generators/invitation/routes/routes_generator.rb
invitation-0.3 lib/generators/invitation/routes/routes_generator.rb
invitation-0.2 lib/generators/invitation/routes/routes_generator.rb