November 22, 2006
It’s interesting to see him propose this pseudo-absolute path scheme. When I started coding in Ruby I used this scheme for the very same reason he mentions. But it soon felt to cumbersome to use. Now I wonder what the real problem with Ruby is.. concerning this path-problem.. it’s very much like a Java classpath problem, isn’t it? Well, of course it’s completely different. But still in the same area.. :)
Anyway, what I’m missing the most with Ruby (Gems), is a way to specify which files are public and which not. This way I would only need to take care of path-related issues in the public entry point into my gem. Everything else could use a require_from_gem method. But this is not really reasonable or possible with Ruby, is it? More probably: You don’t really want this for Ruby.
So I wonder if the burden shouldn’t be on the gem’s user’s shoulder. The gem should probably remain clean and tidy with only relative paths. The user would then have to use something like require_gem_add which loads the gem and adds the root path automagically. Or gem_require should take care of this automagically based on the spec and checking the path. Not sure. Anyway, I don’t think that these clumsy
require File.dirname(__FILE__) + [relative path] statements are the best solution.
Well, just a thought..