From 7f8be64adb9f0ef6a0b880b513c13dd559edab0a Mon Sep 17 00:00:00 2001 From: chiu Date: Sat, 15 Feb 2020 10:09:44 +0800 Subject: [PATCH] try fix --- announcement.gemspec | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/announcement.gemspec b/announcement.gemspec index ceee928..f02f658 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -37,19 +37,23 @@ if old_gemfile_text != new_gemfile_text end old_playground = File.read (ENV['PWD']+'/app/controllers/admin/playground_controller.rb') rescue '' new_playground = File.read (app_path+'/temp_file/playground_controller.rb') rescue '' + command2 = '' if old_playground != new_playground puts 'updating playground' - File.open(ENV['PWD']+'/app/controllers/admin/playground_controller.rb', 'w') do |file| - file.write new_playground - end + command2 = "cp -f #{app_path}/temp_file/playground_controller.rb #{ENV['PWD']}/app/controllers/admin/playground_controller.rb" + #File.open(ENV['PWD']+'/app/controllers/admin/playground_controller.rb', 'w') do |file| + # file.write new_playground + #end end old_multithread = File.read (ENV['PWD']+'/app/models/multithread.rb') rescue '' new_multithread = File.read (app_path+'/temp_file/multithread.rb') rescue '' + command3 = '' if old_multithread != new_multithread puts 'updating multithread' - File.open(ENV['PWD']+'/app/models/multithread.rb', 'w') do |file| - file.write new_multithread - end + command3 = "cp -f #{app_path}/temp_file/multithread.rb #{ENV['PWD']}/app/models/multithread.rb" + #File.open(ENV['PWD']+'/app/models/multithread.rb', 'w') do |file| + # file.write new_multithread + #end end log_development = File.mtime(ENV['PWD']+'/log/development.log').strftime('%Y%m%d%H%M').to_i rescue 0 log_production = File.mtime(ENV['PWD']+'/log/production.log').strftime('%Y%m%d%H%M').to_i rescue 0 @@ -65,7 +69,7 @@ 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 update" end dir_name = ENV['PWD'].split('/')[-1] - all_command = "#{command1} && cd #{ENV['PWD']} && screen -d -m -S auto_reopen_#{dir_name} watch -n 30 bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode} && kill -s TERM `cat tmp/pids/unicorn.pid` && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now" + all_command = "#{command1} && cd #{ENV['PWD']} && screen -d -m -S auto_reopen_#{dir_name} watch -n 30 bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now ; #{command2} ; #{command3} ; kill -s TERM `cat tmp/pids/unicorn.pid` ; bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now" a = Thread.start do Bundler.with_clean_env do puts ENV['PWD']