warbled gems not seen by Rakefile

168 views Asked by At

I have s sinatra app warbled and deployed on glassfish. I have used bundler to manage dependencies and warbler has included those gems in WEB-INF/gems directory.

But when i try to run a rake task from WEB-INF directory, that task is not running.

gfish@server2:~/glassfish/domains/domain1/applications/sinatra_app/WEB-INF$ rake resque:work
(in /home/gfish/glassfish/domains/domain1/applications/sinatra_app/WEB-INF)
rake aborted!
Could not find gem 'sinatra (>= 0, runtime)' in any of the gem sources listed in your Gemfile.
/home/gfish/glassfish/domains/domain1/applications/sinatra_app/WEB-INF/Rakefile:5:in `(root)'
(See full trace by running task with --trace)

gfish@server2:~/glassfish/domains/domain1/applications/sinatra_app/WEB-INF$ **ls -l** gems/gems/
total 104
...
drwxr-xr-x 4 root root 4096 2011-02-24 14:38 sinatra-1.1.3
1

There are 1 answers

0
Pratik Khadloya On BEST ANSWER

I finally found it. I used the following code to do it.

# Add warbled gems to the $LOAD_PATH
if ENV['RACK_ENV'] == "production"
  puts "Adding warbled gems to the load path..."
  local_gems_path = Dir[File.expand_path(".") + "/gems/gems/*"]
  local_gems_path.each do |g|
    $LOAD_PATH.unshift "#{g}/lib/"
  end
end