Project

General

Profile

Defect #38707 » 0002-refactor-to-more-simply-code.patch

Nishida Yuya, 2023-06-13 14:30

View differences:

config/routes.rb
404 404

  
405 405
  get 'robots', :to => 'welcome#robots'
406 406

  
407
  Dir.glob(File.expand_path("#{Redmine::Plugin.directory}/*")).sort.each do |plugin_dir|
408
    file = File.join(plugin_dir, "config/routes.rb")
409
    if File.exist?(file)
410
      begin
411
        instance_eval File.read(file)
412
      rescue SyntaxError, StandardError => e
413
        puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
414
        exit 1
415
      end
416
    end
407
  Redmine::Plugin.directory.glob("*/config/routes.rb").sort.each do |plugin_routes_path|
408
    instance_eval(plugin_routes_path.read, plugin_routes_path.to_s)
409
  rescue SyntaxError, StandardError => e
410
    plugin_name = plugin_routes_path.parent.parent.basename.to_s
411
    puts "An error occurred while loading the routes definition of #{plugin_name} plugin (#{plugin_routes_path}): #{e.message}."
412
    exit 1
417 413
  end
418 414
end
(2-2/2)