Defect #12590
closedPlugin routes.rb files are not getting included on Windows
0%
Description
Don't know if this is a new defect, the only defect I found similar has been #11609.
Routes.rb of plugins do not get processed, as a loop in routes.rb of Redmine does not read include them.
In short: Ruby 1.9.3, RubyGems 1.8.24, Rails 3.2.8, development and production, Windows 2012 Standard Server
See rake about and gem list attached for more Information.
I narrowed the issue down to a problem with the routes.rb file of Redmine.
On the bottom of the file there is some logic that does a Dir.glob(File.join(...)) and processes the directories within a loop.
Unfortunately only one iteration is done in this loop, thus only <REDMINE_ROOT>\plugins\.\routes.rb is being examined by File.exists.
I rewrote the loop now all plugins are loading correctly, and the controllers are getting mapped.
plugin_root = File.join(Rails.root, "plugins") Dir.foreach(File.join(plugin_root) do |plugin_dir| next if plugin_dir == '.' or plugin_dir == '..' file = File.join(plugin_root, plugin_dir, "config/routes.rb") if File.exists?(file) begin Rails.logger.info 'Loading plugin routes from ' + file instance_eval File.read(file) rescue Exception => e puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." exit 1 end end end
Files
Related issues
Updated by Stefan Mueller about 12 years ago
sorry typo in code block.
plugin_root = File.join(Rails.root, "plugins") Dir.foreach(plugin_root) do |plugin_dir| next if plugin_dir == '.' or plugin_dir == '..' file = File.join(plugin_root, plugin_dir, "config/routes.rb") if File.exists?(file) begin Rails.logger.info 'Loading plugin routes from ' + file instance_eval File.read(file) rescue Exception => e puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." exit 1 end end end
Updated by Jean-Philippe Lang about 12 years ago
- Resolution set to Cant reproduce
Stefan Mueller wrote:
I narrowed the issue down to a problem with the routes.rb file of Redmine.
On the bottom of the file there is some logic that does a Dir.glob(File.join(...)) and processes the directories within a loop.
Unfortunately only one iteration is done in this loop, thus only <REDMINE_ROOT>\plugins\.\routes.rb is being examined by File.exists.
I just made the test with 2 plugins under Windows 7. The routes of both plugins are loaded just fine.
Updated by Logan Raarup about 12 years ago
Hi,
This issue seems to be related with a bug in File.expand_path: http://bugs.ruby-lang.org/issues/7374
Updated by Jean-Baptiste Barth over 10 years ago
- Status changed from New to Closed
- Assignee set to Jean-Baptiste Barth
Unable to reproduce on Windows XP too. I close the issue for now but encourage anybody who might experience it to reopen and comment with all details (especially ruby version, and informations about the operating system).