我正在尝试使用capistrano来处理我的Rails 3.2.1应用程序的部署。
运行cap deploy:update
Could not find capistrano-2.11.0 in any of the sources
我遇到了capistrano-2.11.0的问题,因此我将其降级为2.9.0。
的Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'capistrano', '2.9.0'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
bundle show capistrano
:
/Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.9.0
为什么要找capistrano-2.11.0?
Capfile:
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
#require 'deploy'
# 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
配置/ deploy.rb
require 'bundler/capistrano'
set :application, "CapistranoApp"
set :repository, "ssh://ubuntu@ror.weaponxo.com/home/ubuntu/projectdir.git"
set :applicationdir, "/var/www/#{application}"
set :domain, "ror.weaponxo.com"
set :use_sudo, false
set :user, "ubuntu"
#set :default_environment, {'PATH' => "/home/ubuntu/.rvm/rubies/ruby-1.9.2-p290/bin/:$PATH"}
set :scm, :git
set :branch, "master"
set :git_shallow_clone, 1
set :scm_verbose, true
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Rails migrations will run
set :deploy_to, applicationdir
set :deploy_via, :remote_cache
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_ruby_string, 'ruby-1.9.2-p290' # Or whatever env you want it to run in.
set :rvm_type, :user # Copy the exact line. I really mean :user here
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# 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
我最初运行gem install capistrano
,那个版本(2.11.0)隐藏在某个地方吗?
由于
注意,capistrano-2.9.0是唯一安装的版本,我之前运行bundle uninstall capistrano
并删除了2.11.0。
我跑bundle exec cap deploy:update
但仍然遇到同样的错误。
我将我的Gemfile.lock文件重新发送到了repo。它读取capistrano 2.9.0。
正在运行cap deploy:cold
。
答案 0 :(得分:3)
Capistrano 2.11.0被从宝石中拉出来。新版本是2.11.1。
2.11.1也被猛拉了。目前在2.11.2
答案 1 :(得分:1)
您可以使用bundle exec cap deploy
,它将使用Gemfile中指定的capistrano版本
答案 2 :(得分:1)
在运行gem特定命令时卸载capistrano 2.11.0或始终使用bundle exec
,以便它使用gemfile中指定的版本。
bundle exec cap deploy:update