From cef19ae494ef39332e5733a40a3b47a51ee0c0eb Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 20 Feb 2020 17:56:19 +0800 Subject: [PATCH] auto input git name and email if not existed --- temp_file/app/controllers/admin/sites_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/temp_file/app/controllers/admin/sites_controller.rb b/temp_file/app/controllers/admin/sites_controller.rb index bc26937..a936139 100644 --- a/temp_file/app/controllers/admin/sites_controller.rb +++ b/temp_file/app/controllers/admin/sites_controller.rb @@ -174,6 +174,12 @@ class Admin::SitesController < OrbitAdminController "#{git} add -f '#{v}'" end.join(' && ') time_now = Time.now.strftime('%Y_%m_%d_%H_%M') + if %x[git config user.name].empty? + %x[git config --global user.name "rulingcom"] + end + 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}")} mul.update_attributes(status: 'finish') end