# How to use 2.1 gem dependencies

**URL:** <https://www.ruby-forum.com/t/how-to-use-2-1-gem-dependencies/143477>\
**Category:** Rails\
**Created:** [July 19, 2008, 4:11am UTC](https://www.ruby-forum.com/t/how-to-use-2-1-gem-dependencies/143477 "2008-07-19T04:11:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [July 19, 2008, 4:11am UTC](https://www.ruby-forum.com/t/how-to-use-2-1-gem-dependencies/143477/1 "2008-07-19T04:11:50Z")

</div>

Gem dependencies seems to be caught in a catch-22: if I put a config.gem  
statement in environment, and then write some code to use that gem in a  
rake task or in a controller (such as a ‘require’ statment), then rake  
will no longer work. It is broken, because the gem is not installed.  
Moreover, I can’t install the gem, because rake is broken when it tries  
to load the envioronment.

How do I get around this? This seems like a core deployment scenario, I  
can’t help but feel like I am missing some key part of 2.1 gem  
dependencies.

Here’s a specific example:

run: rails /home/user/test/  
edit: enviornment.rb, uncomment the line config.gem “bj”  
add: test.rake to ./lib/tasks  
edit: test.rake:

namespace :test do  
require ‘bj’  
desc ‘test’  
task :test =\> :environment do  
puts Time.now  
end  
end

run: rake gems:install

the last command will fail, because the bj gem is not there.
