Sha256: 7effafe76d5785a8c9b6a507d6f3034841552499039c36a52ab8ddea6868ba27

Contents?: true

Size: 831 Bytes

Versions: 2

Compression:

Stored size: 831 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'

class SimpleAdminGenerator < Rails::Generators::Base
  desc <<-CONTENT
  This will mount SimpleAdmin in your routes.rb using the admin \
  path. It will also install a simple_admin initializer file in \
  your config where you can setup the options.\
  \
  Once complete, register admin interfaces like app/admin/posts.rb:\
  \
    SimpleAdmin.register :posts do\
    end\

  CONTENT

  def self.source_root
    File.join(File.dirname(__FILE__), 'templates')
  end

  def copy_initializer_file
    copy_file 'initializer.rb', 'config/initializers/simple_admin.rb'
  end

  def app_admin
    empty_directory('app/admin')
  end

  def add_simple_admin_routes
    simple_admin_routes = %(mount SimpleAdmin::Engine => '/admin'\n)
    route simple_admin_routes
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_admin-0.2.1 lib/rails/generators/simple_admin/simple_admin_generator.rb
simple_admin-0.1.0 lib/rails/generators/simple_admin/simple_admin_generator.rb