嗨,我想我错过了一些基本的东西。
我正在使用Capistrano进行“整合”,然后进行“测试”。
我似乎无法添加gem,然后使用Capistrano成功部署到其中一个网站('testing')。但是我可以将它成功部署到另一个('集成')。
我正在尝试添加bootstrap-sass'〜> 3.0.2.0',但当我尝试添加它们时,其他宝石也会出现同样的错误。
当我尝试使用“上限测试部署”部署到“测试”时,我收到一条错误,内容为
whenever --update-crontab registration --set environment=testing --roles db"
servers: ["test.calm.dhamma.org"]
[test.calm.dhamma.org] executing command
*** [err :: test.calm.dhamma.org] /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize'
*** [err :: test.calm.dhamma.org] :
*** [err :: test.calm.dhamma.org] Could not find bootstrap-sass-3.0.3.0 in any of the sources
*** [err :: test.calm.dhamma.org] (
*** [err :: test.calm.dhamma.org] Bundler::GemNotFound
*** [err :: test.calm.dhamma.org] )
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
*** [err :: test.calm.dhamma.org] from /home/calm/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
etc..
我花了很长时间寻找没有成功的答案。我有
require 'bundler/capistrano'
在我的Capfile.rb中,如下所示。
require "rvm/capistrano"
#set :rvm_type, :system # :user is the default
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system
puts "RVM ruby string = "
puts rvm_ruby_string
#set :rvm_ruby_string, :local
#
set :rvm_autolibs_flag, "read-only"
before 'deploy:setup', 'rvm:install_rvm'
before 'deploy:setup', 'rvm:install_ruby'
require 'bundler/capistrano'
require 'capistrano/ext/multistage'
set :stages, ["integration","testing", "production"]
set :default_stage, "integration"
# use whenever gem. Only if you have chron jobs
require "whenever/capistrano"
set :whenever_command, "bundle exec whenever"
set :application, "registration"
set :repository, "ssh://gitrepo@tools.calm.dhamma-eu.org/home/gitrepo/repositories/registration"
#set :repository, "ssh://gitrepo@94.23.144.59/home/gitrepo/repositories/registration"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :deploy_to, "/home/calm/wwwshare/registration"
set :user, "calm"
set :use_sudo, false
set :ssh_options, { :forward_agent => true }
#set :deploy_to, "/home/calm/wwwshare/#{application}"
set :deploy_via, :remote_cache
#before "deploy:bundle_gems","deploy:symlink_vendor"
#after "deploy", "deploy:bundle_gems"
#after "deploy:bundle_gems", "assets:symlink"
#after "assets:symlink", "deploy:copy_database_configuration"
#after "deploy:copy_database_configuration", "deploy:restart"
# http://beginrescueend.com/integration/capistrano/
#set :default_environment, {
# 'PATH' => "/home/calm/.rvm/gems/ruby-1.9.3-p448/bin:/home/calm/.rvm/gems/ruby-1.9.3-p448@global/bin:/home/calm/.rvm/bin:/home/calm/.rvm/rubies/ruby-1.9.3-p448/bin:$PATH",
# 'RUBY_VERSION' => 'ruby-1.9.3-p448',
# 'GEM_HOME' => '/home/calm/.rvm/gems/ruby-1.9.3-p448',
# 'GEM_PATH' => '/home/calm/.rvm/gems/ruby-1.9.3-p448:/home/calm/.rvm/gems/ruby-1.9.3-p448@global',
# 'BUNDLE_PATH' => '/home/calm/.rvm/gems/ruby-1.9.3-p448' # If you are using bundler.
#}
#task :testing do
# server 'THE-SERVER.mudbugmedia.com', :web, :app, :db, :primary => true
# set :deploy_to, '/home/calm/wwwshare/#{application}'
# set :rails_env, 'testing'
# set :branch, 'master'
#end
after 'deploy:setup', :create_configs
desc 'Create the shared/config dir for various config files'
task :create_configs do
run "mkdir -p #{shared_path}/config"
run "touch #{shared_path}/config/database.yml"
end
after 'deploy:finalize_update', :update_configs
desc 'Copy the shared config files to the release config dir'
task :update_configs do
run "cp -Rf #{shared_path}/config/* #{release_path}/config"
end
#after 'deploy:finalize_update', :bundle_gems
#desc "Install gems ??? or require 'bundler/capistrano'"
#task :bundle_gems do
# run "cd #{release_path} && bundle install --path vendor/gems"
#end
# If you are using Passenger
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
我尝试通过编辑Gemfile和Gemfile.lock直接在'testing'网站上安装gem,以便与我的开发和'集成'站点上的那些一致并运行bundle install。
然后,当我'捆绑显示'我得到
bundle show bootstrap-sass
....../.rvm/gems/ruby-1.9.3-p448/gems/bootstrap-sass-3.0.2.1
然后:
bundle exec gem list
Could not find bootstrap-sass-3.0.2.1 in any of the sources
Run `bundle install` to install missing gems.
上限测试部署仍然失败
在工作的网站上安装了gem,如下所示:
bundle show bootstrap-sass
...../registration/shared/bundle/ruby/1.9.1/gems/bootstrap-sass-3.0.2.1
与我在不起作用的网站上手动安装的地方不同。
所以,我的问题是:
为什么卡皮斯特拉诺未能将新宝石添加到一个网站但是却没有成功?
我应该直接在不能正常工作的网站上安装gem吗?如果这是一个好主意,我怎么能把它安装到正确的地方?
赖安
答案 0 :(得分:0)
现在让我的评论回答:
它现在正在运行 - 似乎存在不同ruby版本的问题。我在当地有1.9.7 p448,测试时有1.9.7 p484。我们只是将每台机器上的所有版本设置为相同的版本,现在我可以使用Capistrano根据Gemfile的更改来更新gem。