thor breaks when merb:gem:install'ing locally-developed (unreleased) gems #3

Open
jpr5 opened this Issue May 29, 2009 · 1 comment

2 participants

@jpr5

Use case: work on a new merb project, write a new internal plugin/gem for use in the project, then bundle it in for other devs to use.

Result: thor/rubygems chokes on not being able to "find" the new locally-developed gem, regardless of the gem being installed into the system gem dir or locally inside the app's gem dir.

(Tried from both publicly available merb gems and merb edge gems, with same result.)

Steps to repro:
1. Install a gem that's not (yet) included in the rubygems index (i.e. dm-salesforce)
git clone git://github.com/jpr5/dm-salesforce.git
cd dm-salesforce
rake gem
sudo gem install pkg/dm-salesforce-0.9.9.gem

2. Setup new app
    merb-gen app foo
    cd foo && merb-gen thor

3. Add gem to app's dependencies
    cd foo && echo 'dependency "dm-salesforce"' >> config/dependencies.rb

4. Bundle the gems in the app
    cd foo && thor merb:gem:install

Breakage:
    ...
    Installing dm-validations-0.9.11
    Installing dm-serializer-0.9.11
    Installing merb_datamapper-1.0.11
    Cannot find dm-salesforce (, runtime)
    A required dependency dm-salesforce (, runtime) was not found
    Rolling back transaction
    $

I tried installing the gem into the app gems dir (instead of system), and then invoking thor merb💎install. thor breaks a different way; it properly discerns what dm-salesforce's dependencies are and installs them, but cannot "find" them even though they are installed in the system gem directory (httpclient, soap4r, etc).

I noticed that rubygems dependency_installer will slap a ".gem" on the end of the dependency name and attempt to treat it as a path reference. When I change dependencies.rb to read: dependency "/home/jpr5/dm-salesforce/pkg/dm-salesforce-0.9.9", thor properly parses out the dependencies, installs them, and then breaks again:

$ thor merb:gem:install
...
Installing dm-validations-0.9.11
Installing dm-serializer-0.9.11
Installing merb_datamapper-1.0.11
Installing rcov-0.8.1.2.0
Building native extensions.  This could take a while...
Installing columnize-0.3.0
Installing linecache-0.43
Building native extensions.  This could take a while...
Installing ruby-debug-base-0.10.3
Building native extensions.  This could take a while...
Installing ruby-debug-0.10.3
Installing httpclient-2.1.4
Installing soap4r-1.5.8
Installing dm-salesforce-0.9.9
A required dependency /home/jpr5/dm-salesforce/pkg/dm-salesforce-0.9.9 (, runtime) was not found
Rolling back transaction
$

AFAICT one of the problems is that the underlying rubygems impl is ignorant of gems that aren't already present in the specs/latest_specs indices.

@mkaito

Run rake gem in the gem's source folder, and copy the generated gem file to MERB_ROOT/gems/cache. Make sure you add it to dependencies.rb, and then call thor merb:gems:redeploy to unfold it.

You only need to keep the file in gems/cache around so thor merb💎redeploy works on your production server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment