droptheplot/adminable

View on GitHub
lib/generators/adminable/install_generator.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'rails/generators/base'

module Adminable
  module Generators
    class InstallGenerator < Rails::Generators::Base
      source_root File.expand_path('../install/templates', __FILE__)

      def create_controller
        template(
          'application_controller.rb',
          'app/controllers/adminable/application_controller.rb'
        )
      end

      def mount_engine
        insert_into_file(
          "#{Rails.root}/config/routes.rb",
          after: /routes.draw.do\n/
        ) do
          %(  mount Adminable::Engine, at: '/admin'

)
        end
      end
    end
  end
end