This project is archived and is in readonly mode.

#362 ✓duplicate
Andreas Fuchs

GemDependency#add_load_paths does not get them all (and is not tested)

Reported by Andreas Fuchs | June 7th, 2008 @ 12:35 PM

Some gems like rmagick search for files in bin/. There was a patch recently (71528b1825ce5184b23d09f923cb72f4073ce8ed) that added the lib/ directory to $LOAD_PATH.

I reworked that to include a gem's bin/, as well. Attached, find the patch, test included.

Comments and changes to this ticket

  • Andreas Fuchs

    Andreas Fuchs June 7th, 2008 @ 03:24 PM

    Argh, this is entirely the wrong fix. The right thing, of course, is to load the Gem specification from the locally installed .specification file and use the require_paths declared therein.

    The patch (against v2.1.0) that I'm attaching does this. (Includes a test case.)

  • Pratik

    Pratik July 2nd, 2008 @ 01:40 AM

    • Tag set to bug, gem, patch, railties
    • Assigned user set to “Rick”
  • Matt Harvey

    Matt Harvey September 17th, 2008 @ 09:48 PM

    • Title changed from “GemDependency fails for gems that search for files in bin/” to “GemDependency#add_load_paths does not get them all (and is not tested)”
    • Tag changed from bug, gem, patch, railties to bug, gem, patch, railties

    This is a good concept. The test is not actually hitting your change, though. It's not really your fault, since you followed a pattern that was not hitting the lines that you removed anyway. That's because GemDependency.unpacked_paths is always empty in the test cases.

    I came upon this after I had a related problem; hpricot does not load when an unpacked and built version under vendor is the only version present on the system. That failure is due to the fact that its compiled extensions are located in subdirectories of ext rather than in ext itself. It would be nice if such subdirectories were reliably listed in the require_paths of .specfication, but at least in the case of hpricot, we can't count on that.

    My patch was going to conflict with yours, and yours did not apply, so I have integrated the two into a new patch (attached).

    It is probably worth noting that, in the same vein, the .specification for rmagick, at least on my system, does not include bin in the require_paths. I included something to address that as well.

  • Pratik

    Pratik December 20th, 2008 @ 07:29 PM

    • Assigned user changed from “Rick” to “Pratik”

    Waiting for Matt Jones' review.

  • Matt Jones

    Matt Jones December 20th, 2008 @ 09:13 PM

    This is now handled via the standard Gem specificiation loader used in #1128. OK to close.

  • Pratik

    Pratik December 20th, 2008 @ 09:39 PM

    • State changed from “new” to “duplicate”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages