Bunder problem with a Rails gem that has generators
Thursday, November 4, 2010 at 1:05PM I ran into this problem recently so I thought I’d share.
I have a gem that I am working on. For development I use bundler and have a hard coded :path to where the gem source code is located. This allows me to develop in the context of a Rails app and have any change I make to the gem immediately available it the app. This works fine except for the generators in the gem.
With a Gemfile like this source :rubygems
gem 'rails', '2.3.10'
gem 'surveyor', :path => '/Users/brian/Rails/surveyor_for_dev'
I get “Couldn’t find ‘surveyor’ generator” when I run bundle exec script/generate surveyor from the cmd line.
If I change that line in the Gemfile and remove everything after the “gem ‘surveyor’” part, bundle install, and run the same command, everything works fine.
What I’ve had to do is use the gem for running the generators, then remove the gem from the system (or gemset) and rebundle. This way I can work on the gem despite the issue bundler is causing.
This problem has something to do with how Rails looks up generators, bundler is not providing the gem generators for local gems to Rails in the proper way.
I don’t have a good solution at this time for the problem. It’s just something to keep in mind when doing Rails gem development using bundler.

