require 'rails' module Plugins module Generators class ReportGenerator < Rails::Generators::Base desc "Create report." def report_initializer_file filePath = File.expand_path(File.dirname(File.dirname(__FILE__))) currPath = File.expand_path("../../", filePath) reportPath = File.expand_path("../../plugins/report/", filePath) FileUtils.cp_r "#{reportPath}/db/migrate", "db/" FileUtils.cp_r "#{reportPath}/app/controllers", "app/" FileUtils.cp_r "#{reportPath}/app/models", "app/" FileUtils.cp_r "#{reportPath}/app/views", "app/" FileUtils.cp_r "#{reportPath}/app/views", "app/" FileUtils.cp_r "#{reportPath}/public/echarts2", "public/" FileUtils.cp_r "#{reportPath}/public/echarts3", "public/" FileUtils.cp_r "#{currPath}/lib/tasks/report_menu.rake", "lib/tasks/" puts "完成report模块构建" route("resources :connects") route("resources :dictionaries") route("resources :reports do resources :series and resources :requirements end") puts "report routes created!" end end end end