I was wondering something. I see this all the time at the top of
files, or some variation of it that uses File.join. Another approach
is to augment the load path, or $:
Since this is such a common idiom, why hasn't it been converted into a
gem? What I think is the reason, is because in order to do one
require, you'd have to do 2 other ones: rubygems, and the gem that had
the File.expand_path. Also, the __FILE__ would have to be passed in,
since it would be different for the gem .rb file.
But, 1.9 has gems built in. So for that, it would make sense if you
had to require a lot of files. Something like:
require "relative_require"
require_relative __FILE__, "..", "lib". "methods1"
...
require_relative __FILE__, "..", "lib". "methods3"
require_relative __FILE__, "../lib/methods4"
-- or --
require "relative_require
augment_path __FILE__, "..", "lib"
require "methods1"
..
require "methods4"
Also, do they use the File.join idiom to make it portable to Windows?
Am I missing something?
Thanks
Ed
--
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland
Seems, this discussion has been going on for a while. Matz has
consistently turned it down for core, but it seems to be in my 1.9.1
compiled for Mac, anyway, though the Internets say it is scheduled for
1.9.2.
My guess is it isn't portable, at least not to the 1.8.x crowd (LUsers :)
HaHa.
I also don't like that it takes a single argument, instead of *paths.
Again I wonder about the Windows users. Also, I do like that it
doesn't need __FILE__, since it extends module Kernel and uses the
caller[0] for that.
Ed
> On that note, Robert Citek and I came up with a nice way to
> switch between ruby 1.6 and 1.9.1 on Ubuntu Karmic. If you install
> both 1.8 and 1.91 via apt-get, you get the 1.9.1 versions with 1.9,1
> appended to each executable (/usr/bin/ruby1.9.1, /usr/bin/irb1.9.1
> etc.).
>
Have you tried RVM [1]? I'm using it on Ubuntu Karmic. I also have a
project called pik[2], which does something similar for windows users.
[1] http://rvm.beginrescueend.com/
[2] http://github.com/vertiginous/pik
Gordon
http://github.com/manveru/ramaze/blob/master/lib/ramaze/snippets/object/__dir__.rbMaybe someone needs to simply create a patch and submit it to this thread??
--
You received this message because you are subscribed to the Google Groups "Saint Louis Ruby Users Group" group.
To post to this group, send email to stl...@googlegroups.com.
To unsubscribe from this group, send email to stlruby+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/stlruby?hl=en.