2012-01-18 93 views
2

我嘗試通過Capistrano運行我的應用程序。此外,我使用:Rails 3.1:無法找到耙

Ubuntu 10.04.1 LTS 
Phusion Passenger 
PostgreSQL 9 
Nginx 
Rails 3.1.3 
Ruby 1.9.3 

我做

cap deploy:update 

它創建的文件夾和後等

然後我嘗試在/電流文件夾

rake RAILS_ENV=production db:schema:load 

而現在顯示下一個:

Could not find rake-0.9.2.2 in any of the sources 
Run `bundle install` to install missing gems. 

但它的安裝!我試過$ bundle install,$ gem update rake它沒有幫助。此錯誤一次又一次出現。

$寶石列表

*** LOCAL GEMS *** 

actionmailer (3.1.3) 
actionpack (3.1.3) 
activemodel (3.1.3) 
activerecord (3.1.3) 
activeresource (3.1.3) 
activesupport (3.1.3) 
ansi (1.4.1) 
arel (2.2.1) 
autotest (4.4.6) 
builder (3.0.0) 
bundler (1.0.21 ruby) 
coffee-rails (3.1.1) 
coffee-script (2.2.0) 
coffee-script-source (1.2.0) 
daemon_controller (0.2.6) 
erubis (2.7.0) 
execjs (1.2.13) 
fastthread (1.0.7) 
ffi (1.0.11) 
gravatar_image_tag (1.0.0) 
hike (1.2.1) 
i18n (0.6.0) 
jquery-rails (1.0.19) 
json (1.6.5) 
libv8 (3.3.10.4 x86_64-linux) 
mail (2.3.0) 
mime-types (1.17.2) 
multi_json (1.0.4) 
passenger (3.0.11) 
pg (0.12.2) 
polyglot (0.3.3) 
rack (1.3.6) 
rack-cache (1.1) 
rack-mount (0.8.3) 
rack-ssl (1.3.2) 
rack-test (0.6.1) 
rails (3.1.3) 
railties (3.1.3) 
rake (0.9.2.2, 0.9.2) 
rdoc (3.12) 
sass (3.1.12) 
sass-rails (3.1.5) 
sprockets (2.0.3) 
sqlite3 (1.3.5) 
sys-uname (0.9.0) 
texticle (2.0) 
therubyracer (0.9.9) 
thor (0.14.6) 
tilt (1.3.3) 
treetop (1.4.10) 
turn (0.8.3) 
tzinfo (0.3.31) 
uglifier (1.2.2) 
will_paginate (3.0.2) 
ZenTest (4.6.2) 

$寶石列表耙

*** LOCAL GEMS *** 

rake (0.9.2.2, 0.9.2) 

這裏是我的配置/ deploy.rb

set :user, "root"                

set :rails_env, "production" 

default_run_options[:pty] = true            
set :repository, "git://github.com/Loremaster/sample_app.git" 

set :application, "ror_tutorial" 
set :deploy_to, "/vol/www/apps/#{application}" 

set :scm, :git 
set :branch, "master" 

server "xxx.xxx.xxx.xxx", :app, 
          :web, 
          :db, :primary => true 



# If you are using Passenger mod_rails uncomment this: 
namespace :deploy do 
    task :start do ; end 
    task :stop do ; end 
    task :restart, :roles => :app, :except => { :no_release => true } do 
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" 
    end 
end 

Capfile

load 'deploy' if respond_to?(:namespace) # cap2 differentiator 

# Uncomment if you are using Rails' asset pipeline 
# load 'deploy/assets' 

Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } 

load 'config/deploy' # remove this line to skip loading any of the default tasks 

UPD:我在Gemfile中添加耙寶石,然後我的本地機器上運行bundle install,然後通過Capistrano的上傳服務器上的固定佣金錯誤。

回答

0

我固定耙誤差在Gemfile中添加gem rake,然後我的本地機器上運行bundle install,然後通過Capistrano的上傳服務器上。

+0

我不認爲這是做到這一點的正確方法,儘管它可能有效。我的答案是否在下面的工作,因爲更好的方法是讓capistrano用戶成爲唯一可以執行rails命令的用戶。另外,rake確實不應該在gemfile中。 – 2012-01-19 00:12:17

+0

我的系統中沒有「capistrano」這樣的用戶。這是第一個。我每次嘗試運行'rake RAILS_ENV = production db:schema:load'時都會出現錯誤'找不到耙子',這是第二個。 – ExiRe 2012-01-20 11:55:58

0

試試這個:

RAILS_ENV=production bundle exec rake db:schema:load 

它需要打捆的上下文中運行耙。

+0

不,它沒有幫助。 '在任何源中找不到rake-0.9.2.2' – ExiRe 2012-01-18 18:58:54

+0

您是否像在deploy.rb文件中設置的用戶那樣運行它(在本例中爲root)? – 2012-01-18 19:07:00

+0

是的,我做的!我通過ssh來做,而且我是'root'用戶。 – ExiRe 2012-01-18 19:10:56

0

而不是根,我相信你必須做它作爲capistrano。試試這個:

sudo su capistrano 

然後輸入您的密碼,並做

rake RAILS_ENV=production db:schema:load