I'd like to slap everything in vendor/gems/gems/**/lib onto the load path. I've got a way to do it, but it just feels clunky. Right now, I'm doing it via:
base = File.expand_path(File.join(File.dirname(__FILE__), "..", "vendor", "gems", "gems"))
libs = File.join(base, "**", "lib")
Dir.glob(libs) { |lib| $LOAD_PATH.unshift lib}
I'm sure there's a better way to do this.
i think setting up the base path via File is fine. but you don't need to iterate over the list of directories to put them into the $LOAD_PATH. you could use unshift and expand the array.
libs = File.expand_path("../../vendor/gems/**/lib", __FILE__)
$LOAD_PATH.unshift *Dir.glob(libs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With