我正在使用这个脚本(它是从 mina 0.3 升级的)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'
set :shared_dirs, %w(log public/uploads node_modules)
set :current_path, 'current'
set :term_mode, nil
task :environment do
invoke :'rbenv:load'
end
task setup: :environment do
command %[mkdir -p "#{fetch(:shared_path)}/log"]
command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/log"]
command %[mkdir -p "#{fetch(:shared_path)}/public/uploads"]
command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/public/uploads"]
command %[mkdir -p "#{fetch(:shared_path)}/node_modules"]
command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/node_modules"]
end
desc 'Deploys the current version to the server.'
task deploy: :environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'npm_install'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
on :launch do
command "mkdir -p #{fetch(:current_path)}/tmp/"
command "touch #{fetch(:current_path)}/tmp/restart.txt"
end
end
end
task :restart do
command "touch #{fetch(:current_path)}/tmp/restart.txt"
end
task :logs do
command 'echo "Contents of the log file are as follows:"'
command "tail -f #{fetch(:current_path)}/log/#{fetch(:rails_env)}.log"
end
task :npm_install do
command 'npm install --production'
end
问题是 - 每次部署完成时, bundle install
都会从头开始下载所有 gem。 它在 0.3 版上运行良好。
知道我做错了什么吗?
好的,我发现了问题所在。 在版本 1 中,我们需要附加到 shared_dirs 而不是创建整个表。 所以我做了:
set :shared_dirs, fetch(:shared_dirs, []).push('log').push('public/uploads').push('node_modules')
它现在正在工作
谢谢! 我遇到了同样的问题!
并不是要继续封闭线程,但您也可以执行以下操作:
shared_dires = %w{log public/uploads node_modules}
set :shared_dirs, fetch(:shared_dirs, []).push(*shared_dirs)
最有用的评论
好的,我发现了问题所在。 在版本 1 中,我们需要附加到 shared_dirs 而不是创建整个表。 所以我做了:
set :shared_dirs, fetch(:shared_dirs, []).push('log').push('public/uploads').push('node_modules')
它现在正在工作