Sha256: 8241715ba794fb60cf91b44b240f5a98e5260910f6f7f1c29ea6c1fff1783baa

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

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

      def install
        copy_file 'admin_controller.rb', 'app/controllers/admin_controller.rb'
        template 'admin.html.erb', 'app/views/layouts/admin.html.erb'
        gsub_file 'app/assets/javascripts/application.js', /require_tree.*/, 'require_tree ./application'
        gsub_file 'app/assets/stylesheets/application.css', /require_tree.*/, 'require_tree ./application'
        copy_file 'admin.js', 'app/assets/javascripts/admin.js'
        copy_file 'admin.css', 'app/assets/stylesheets/admin.css'
        create_file 'app/assets/javascripts/admin/.keep'
        create_file 'app/assets/stylesheets/admin/.keep'
        insert_into_file 'config/initializers/assets.rb', 'Rails.application.config.assets.precompile += %w[admin.js admin.css]', after: /\Z/
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adminscaffold-1.0.1 lib/generators/admin_scaffold/install_generator.rb
adminscaffold-1.0.0 lib/generators/admin_scaffold/install_generator.rb