Rakefile看不到的吵架宝石

时间:2011-02-24 20:50:53

标签: glassfish warbler

我的sinatra应用程序发生故障并部署在glassfish上。我使用了bundler来管理依赖项,warbler将这些gem包含在WEB-INF / gems目录中。

但是当我尝试从WEB-INF目录运行rake任务时,该任务没有运行。

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 个答案:

答案 0 :(得分:0)

我终于找到了它。我使用以下代码来完成它。

# 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