【发布时间】:2012-02-13 11:57:44
【问题描述】:
我尝试通过 Capistrano 运行我的应用程序。我也使用:
Ubuntu 10.04.1 LTS
Phusion Passenger
PostgreSQL 9
Nginx
Rails 3.1.3
Ruby 1.9.3
我做了之后
cap deploy:update
它创建文件夹等。
然后我在 /current 文件夹中尝试
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)
$gem list rake
*** LOCAL GEMS ***
rake (0.9.2.2, 0.9.2)
这是我的 config/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 中添加 rake gem 修复了 Rake 的错误,然后在我的本地计算机上运行 bundle install,然后通过 Capistrano 将其上传到服务器上。
【问题讨论】:
标签: ruby-on-rails-3.1 rake capistrano ubuntu-10.04 passenger