Sha256: 99af44588c1cde7cb0594280252235797f170c6166dfc6eea259b3523e377772

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

require 'rails'

module App
  module Generators
    class InstallGenerator < Rails::Generators::Base
      desc "Create member role magager system."
      def admin_app_initializer_file
        filePath = File.expand_path(File.dirname(File.dirname(__FILE__)))
        currPath = File.expand_path("../../", filePath)
        FileUtils.cp_r "#{currPath}/public/admin", "public/"
        FileUtils.cp_r "#{currPath}/app/controllers", "app/"
        FileUtils.cp_r "#{currPath}/app/models", "app/"
        FileUtils.cp_r "#{currPath}/app/views", "app/"
        FileUtils.mv "Gemfile", "GemfileBak" unless File.exist?("GemfileBak")
        FileUtils.cp_r "#{currPath}/Gemfile", "."
        FileUtils.mv "db/seeds.rb", "db/seeds.rb.bak" unless File.exist?("db/seeds.rb.bak")
        FileUtils.cp_r "#{currPath}/db/seeds.rb", "db/"
        FileUtils.cp_r "#{currPath}/db/migrate", "db/"
        FileUtils.mv "config/routes.rb", "config/routes.rb.bak" unless File.exist?("config/routes.rb.bak")
        FileUtils.cp_r "#{currPath}/config/routes.rb", "config/"
        FileUtils.cp_r "#{currPath}/config/locales", "config/"
        FileUtils.cp_r "#{currPath}/lib/tasks/route_task.rake", "lib/tasks/"
        puts "完成后台管理模块构建"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
admin-sys-1.0.2 lib/generators/app/install_generator.rb
admin-sys-1.0.1 lib/generators/app/install_generator.rb
admin-sys-1.0.0 lib/generators/app/install_generator.rb