Plugin or Gem reuirement, if gem is not installed

It is about rails2

I have a gem that I install as a plugin, I want in development
environment use it from vendor/plugins folder and if it is installed in
system to use the systems gem

But if I use config.gem in environment.rb it raises an error about
missing gem even if it is present in vendor/plugins

Sent from my iPhone

On Apr 15, 2011, at 9:28 AM, Vitaliy Y. [email protected]
wrote:

It is about rails2

I have a gem that I install as a plugin, I want in development
environment use it from vendor/plugins folder and if it is installed in
system to use the systems gem

But if I use config.gem in environment.rb it raises an error about
missing gem even if it is present in vendor/plugins

This is because config.gem is looking for a gem. It won’t fall back and
check for a plugin if it fails to find a gem. I think your best bet is
to use a require statement. It’ll check for the plugin and use that if
it finds it. If not it will look for the gem.

Someone please correct me if I’m wrong. I’ve not actually done this
since I’ve only had one or the other in my apps.

B.

On Apr 15, 10:28am, Vitaliy Y. [email protected] wrote:

It is about rails2

I have a gem that I install as a plugin, I want in development
environment use it from vendor/plugins folder and if it is installed in
system to use the systems gem

But if I use config.gem in environment.rb it raises an error about
missing gem even if it is present in vendor/plugins

Plugins can live in gems, but there’s not an equivalent for the other
direction. What you’ll want to do is to add the config.gem line and
then do:

rake gems:unpack GEM=whatever_the_gem_name_is

which will unpack the gem to vendor/gems along with the needed gemspec
to get things working.

–Matt J.