To my relief, all the fixes were pretty tiny. A couple were already reported and had working patches, so in the end I finished up sending only 3 patches. I wanted to discuss the last one because it is somewhat tricky and I'm not sure of the quality of my solution.
#5278: fix sqlite tests on Windows when Rails path contains spaces
http://dev.rubyonrails.org/ticket/5278
#5276: fix for CGI extensions when they expect string but get nil
http://dev.rubyonrails.org/ticket/5276
#5285: routing broken on win32 after rewrite - Pathname#realpath issue
http://dev.rubyonrails.org/ticket/5285
http://dev.rubyonrails.org/ticket/5278
#5276: fix for CGI extensions when they expect string but get nil
http://dev.rubyonrails.org/ticket/5276
#5285: routing broken on win32 after rewrite - Pathname#realpath issue
http://dev.rubyonrails.org/ticket/5285
Rails uses Pathname library in several places. Unfortunately, Pathname is written only for unix-style paths (stressed out in the docs). Until Pathname2 replaces Pathname (if that ever happens) were stuck with its faulty methods. The culprit here was Pathname#realpath method that didn't know how to recognize absolute paths (ones with drive letters) on Windows.
For my patch I've copied the whole method to ActiveSupport/core_ext in a separate file, fixed the method and included the file from existing pathname.rb:
require
File.dirname(__FILE__) + '/pathname/win32_fix'
I didn't know better (if there IS a better solution). This should work on other platforms as before, but I'll appreciate if someone could test it. The thing that troubles me now is that this fix is always included. Most of the Rails installations will never be on Windows, so they don't need it. I've wondered if it would be more correct if I wrote this:
require File.dirname(__FILE__) + '/pathname/win32_fix' if RUBY_PLATFORM =~ /(?:mswin|mingw|bccwin)32/
However, I haven't yet seen this kind of practice in Rails core. Thoughts? Opinions? What is 'Rails' approach to cross-platform problems?
--
Mislav
_______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core