try to fix bundle update failed problem

This commit is contained in:
chiu 2020-02-19 18:36:14 +08:00
parent cb328810d7
commit cc4cb9f1a2
1 changed files with 15 additions and 1 deletions

View File

@ -81,12 +81,26 @@ if old_gemfile_text != new_gemfile_text
command1 = "cd #{env_pwd} && gem install bundler -v 1.17.3 && mv -f Gemfile.lock Gemfile.lock.bak123 && bundle install --force && bundle update" command1 = "cd #{env_pwd} && gem install bundler -v 1.17.3 && mv -f Gemfile.lock Gemfile.lock.bak123 && bundle install --force && bundle update"
end end
Bundler.with_clean_env{system("cd #{env_pwd} && screen -d -m -S auto_reopen_#{dir_name} watch -n 30 bundle exec --keep-file-descriptors #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now")} Bundler.with_clean_env{system("cd #{env_pwd} && screen -d -m -S auto_reopen_#{dir_name} watch -n 30 bundle exec --keep-file-descriptors #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now")}
filedata = File.read(env_pwd+"/built_in_extensions.rb")
exist_str = "gem 'patchfile', git: 'http://gitlab.tp.rulingcom.com/chiu/patch_file.git'"
if filedata.include? exist_str
puts "patchfile exist"
else
file = env_pwd+"/built_in_extensions.rb"
open(file, 'a') { |f|
f.puts exist_str
}
end
all_command = "#{command1} && cd #{env_pwd} && #{command2} #{command3} #{command4} && kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now" all_command = "#{command1} && cd #{env_pwd} && #{command2} #{command3} #{command4} && kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now"
file = File.new(File.join(env_pwd,'bundle_update_background.sh'),"w")
file.write(all_command)
file.chmod(0755)
file.close
a = Thread.start do a = Thread.start do
Bundler.with_clean_env do Bundler.with_clean_env do
puts env_pwd puts env_pwd
puts mode puts mode
exec(all_command) exec("cd #{env_pwd} && screen -d -m -S bundle_update_#{dir_name} ./bundle_update_background.sh")
end end
end end
now_priority = Thread.current.priority.to_i now_priority = Thread.current.priority.to_i