From cc4cb9f1a271aac1ba776ba073a4fb3fe24e5386 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 19 Feb 2020 18:36:14 +0800 Subject: [PATCH] try to fix bundle update failed problem --- announcement.gemspec | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/announcement.gemspec b/announcement.gemspec index f385387..43323e5 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -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" 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")} + 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" + 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 Bundler.with_clean_env do puts env_pwd puts mode - exec(all_command) + exec("cd #{env_pwd} && screen -d -m -S bundle_update_#{dir_name} ./bundle_update_background.sh") end end now_priority = Thread.current.priority.to_i