好像是 Ruby 环境出了点问题,mina deploy 到 bundle 的时候,会报错,提示安装 rake 10.4.2 服务器上默认 ruby version 是 2.1.3,gem list 中 rake version 默认是 10.4.2 项目下添加了.ruby-version 为什么会有环境问题…?到底是哪里出了问题…求指点迷津……
贴一下 config/deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
set :domain, 'my_ip'
set :deploy_to, '/home/user/apps/project'
set :repository, 'git@my_git_address.git'
set :branch, 'dev'
set :rbenv_path, '/home/user/.rbenv'
# For system-wide RVM install.
# set :rvm_path, '/usr/local/rvm/bin/rvm'
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, ['config/settings.yml']
# Optional settings:
set :user, 'deploy_user' # Username in the server to SSH to.
set :port, '22' # SSH port number.
task :environment do
queue %{export RBENV_ROOT=#{rbenv_path}}
invoke :'rbenv:load'
end
task :setup => :environment do
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]
queue! %[touch "#{deploy_to}/#{shared_path}/config/settings.yml"]
queue %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/settings.yml'."]
end
desc "Deploys the current version to the server."
task :deploy => :environment do
to :before_hook do
# Put things to run locally before ssh
end
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
to :launch do
queue "touch tmp/restart.txt"
end
end
end
我错了。。该问题是 gem 源花式抽风造成的,最后的解决办法是淘宝源和 rubygems 来回切换了十多回总算把 bundle 跑完了…但还是很疑惑 mina deploy 过程为什么要重新 install list 中已经存在的 gem。。目前 mina 还在抽风中,各种不明 failed…唉,结贴