From ec276a225aec637568eb26c2a934b3b38fdad0eb Mon Sep 17 00:00:00 2001 From: chiu Date: Fri, 21 Feb 2020 09:13:37 +0800 Subject: [PATCH] fix update manager error --- announcement.gemspec | 4 ++-- temp_file/Gemfile | 2 +- temp_file/app/controllers/admin/sites_controller.rb | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/announcement.gemspec b/announcement.gemspec index 43323e5..dad26a0 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -76,9 +76,9 @@ if old_gemfile_text != new_gemfile_text Bundler.with_clean_env{%x[screen -ls | grep auto_reopen_#{dir_name} | cut -d. -f1 | awk '{print $1}' | xargs kill]} end if files.count ==0 - command1 = "cd #{env_pwd} && gem install bundler -v 1.17.3 && bundle install --force && bundle update" + command1 = "cd #{env_pwd} && gem install bundler -v 1.17.3 && bundle update --force" else - 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 update --force" 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") diff --git a/temp_file/Gemfile b/temp_file/Gemfile index 3839915..a20381f 100644 --- a/temp_file/Gemfile +++ b/temp_file/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -#complete2!!!!!!!! +#fix update manager error!!!!!!!! #social gems gem "omniauth-google-oauth2" diff --git a/temp_file/app/controllers/admin/sites_controller.rb b/temp_file/app/controllers/admin/sites_controller.rb index a936139..e44309a 100644 --- a/temp_file/app/controllers/admin/sites_controller.rb +++ b/temp_file/app/controllers/admin/sites_controller.rb @@ -170,9 +170,10 @@ class Admin::SitesController < OrbitAdminController git_add_except_public = Dir['*'].select{|v| v!= 'public'}.collect do |v| "#{git} add -f '#{v}'" end.join(' && ') - git_add_all_program = (Dir['app/*'].select{|v| !v.include? 'templates'} + Dir['lib/*'] + Dir['config/*'].select{|v| !v.include? 'mongoid.yml'}).collect do |v| - "#{git} add -f '#{v}'" + git_add_custom = (Dir['*'].select{|v| v !='app' && v != 'lib' && v != 'config'} + ['app/templates','config/mongoid.yml']).collect do |v| + "#{git} add -f --all '#{v}'" end.join(' && ') + git_restore = "#{git} checkout ." time_now = Time.now.strftime('%Y_%m_%d_%H_%M') if %x[git config user.name].empty? %x[git config --global user.name "rulingcom"] @@ -180,7 +181,7 @@ class Admin::SitesController < OrbitAdminController if %x[git config user.email].empty? %x[git config --global user.email "orbit@rulingcom.com"] end - Bundler.with_clean_env{system("#{git_add_except_public} && #{git} commit -m auto_backup_before_#{type}_#{time_now} && #{git} reset #{commit} --mixed && #{git_add_all_program} && #{git} reset #{commit} --merge && #{git_add_except_public}&& #{git} commit -m complete_#{type}_#{time_now}")} + Bundler.with_clean_env{system("#{git_add_except_public} && #{git} commit -m auto_backup_before_#{type}_#{time_now} && #{git} reset #{commit} --mixed && #{git_add_custom} && #{git_restore} && #{git_add_except_public}&& #{git} commit -m complete_#{type}_#{time_now}")} mul.update_attributes(status: 'finish') end end