From: Thomas Sawyer Date: 2011-10-21T16:09:06+09:00 Subject: [ruby-core:40256] [Ruby 1.9 - Feature #5445] Need RUBYOPT -r before ARGV -r Issue #5445 has been updated by Thomas Sawyer. My thought is that it makes sense that RUBYOPT comes first, b/c it defines starting environment. In production is -r even used? Likelihood of compatibility issue is probably extremely low. ---------------------------------------- Feature #5445: Need RUBYOPT -r before ARGV -r http://redmine.ruby-lang.org/issues/5445 Author: Thomas Sawyer Status: Open Priority: Normal Assignee: Category: Target version: Libraries given by -r options in RUBYOPT should be loaded before ones in direct command line arguments. I use a custom load system for development that I have been using for years and it works very well for me. But Ruby has some edge cases that prevents it from being feature complete. One of these is the order in which RUBYOPT is applied vs. -r command line option. My custom loader is too large to include here, so I will simply demonstrate the problem with simple sample code: $ cat req.rb p "Custom Require" module Kernel alias :require0 :require def require(*a) puts "Kernel#require" p a require0(*a) end class << self alias :require0 :require def require(*a) puts "Kernel.require" p a require0(*a) end end end If we load this via RUBYOPT, the result is: $ RUBYOPT=-r./req.rb ruby -rstringio -e0 Custom Require But if we load via -r the result is: $ ruby -r./req.rb -rstringio -e0 Custom Require Kernel#require ["stringio"] I would ask that the output of both invocations to be identical. (Note, the -T option should still allow RUBYOPT to be omitted regardless.) -- http://redmine.ruby-lang.org