Bugs item #25208, was opened at 2009-04-06 18:02
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=25208&group_id=126

Category: other
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jeremy Lawler (jlawler)
Assigned to: Nobody (None)
Summary: Files in the bin directory shouldn't be put in LOAD_PATH

Initial Comment:
If a file is intended to be loaded by a running ruby process (not exec'd), it 
shouldn't be in bin.  You've created a system that uses a standard unix naming 
scheme that you don't implement.  Outside of rubygems, no one add bin 
directories to the load/include paths.  Calling it bin would be like if python 
had all their files end in ".rb" 



>From #rubygems on 2009-04-06:
(04:15:15 PM) drbrain: the executable stubs should probably be updated to use 
Gem.bin_path, now that it exists
(04:16:03 PM) drbrain: until all the bin stubs are migrated on a system, 
though, it has to work this way for backwards compatibility


(More context, if you'd like)
(01:46:34 PM) jlawler: This is what happened to me:  someone puts extensions on 
all their scripts.  I had a gem called Foo.  There was a foo.rb in the lib 
directory that was the app.  But there was driver called foo.rb
(01:47:15 PM) jlawler: because there was a foo.rb in the bin and the lib 
directory, and because the bin directory has higher priority (?!), I got 
exceedingly unexpected results.
(04:01:41 PM) drbrain: jlawler: you should file a bug with whoever added .rb to 
those files
(04:04:07 PM) jlawler: drbrain:  Agreed.  But I still don't understand wtf the 
point of the bin directory is.  If it gets put in LOAD_PATH, it's not a bin 
directory.  I'm trying to understand if there's a reason you guys don't 
consider that a bug...
(04:04:39 PM) drbrain: jlawler: how would "load 'rake'" work otherwise?
(04:08:38 PM) drbrain: it's not a bug because this is how load works
(04:10:17 PM) drbrain: if the exact file name is not on the load path it can't 
be loaded
(04:10:25 PM) jlawler: drbrain: as it exists, you're right, it wouldn't.  If a 
file is intended to be loaded by a running ruby process (not exec'd), it 
shouldn't be in bin.  The "right" way to do that IMO is to have a 
"rake_runner.rb" (or something like that) that you can load, which would live 
in the lib directory.  Hell, they can even do it exactly how they do it now, 
just move the rake file to the lib directory.
(04:12:16 PM) jlawler: You've created a system that uses a standard unix naming 
scheme that you don't implement.  Outside of rubygems, no one add bin 
directories to the load/include paths.  Calling it bin would be like if python 
had all their files end in ".rb" 
(04:14:14 PM) drbrain: jlawler: like I said before, it's done this way for 
historical reasons, largely
(04:15:15 PM) drbrain: the executable stubs should probably be updated to use 
Gem.bin_path, now that it exists
(04:16:03 PM) drbrain: until all the bin stubs are migrated on a system, 
though, it has to work this way for backwards compatibility
(04:16:18 PM) jlawler: drbrain:  I do understand that.  God knows I've 
maintained things I didn't like for historical reasons.  I'd like there to be a 
migration away from that, not that an alternative does exist.  I'm not asking 
you to deprecate it tomorrow, but I think it's a reasonable thing to try to 
deprecate.
(04:16:59 PM) jlawler: I absolutely refuse to believe I'm the only person who 
has had to track down the strange behavior caused by the fact that the same 
file name existed in the bin and lib directories.
(04:17:41 PM) drbrain: you're probably not
(04:34:58 PM) imperator2: jlawler, yes, please file a bug

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=25208&group_id=126
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to