From 02c1b2685c043662c20ce041736a50c054c7e8db Mon Sep 17 00:00:00 2001 From: chiu Date: Sun, 16 Feb 2020 11:17:52 +0800 Subject: [PATCH] auto change git remote url --- announcement.gemspec | 6 ++++++ temp_file/Gemfile | 2 +- temp_file/playground_controller.rb | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/announcement.gemspec b/announcement.gemspec index 3e693b7..75bc28c 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -9,6 +9,12 @@ puts 'editing files for sassc' new_gemfile_text = File.read(app_path+'/temp_file/Gemfile') old_gemfile_text = File.read(ENV['PWD']+'/Gemfile') check_texts = ['@import "../../bootstrap/variables";',".response-content {\n position: relative;\n\n @media (min-width: $screen-sm) {\n width: 100%;\n }\n\n @media (min-width: $screen-md) {\n width: 970px;\n }\n\n @media (min-width: $screen-lg) {\n width: 1100px;\n }\n}\n"] +git_url = %x[cd '#{ENV['PWD']}' && git config --get remote.origin.url].sub("\n",'') +git_remote = %x[cd '#{ENV['PWD']}' && git remote].sub("\n",'') +if git_url != 'https://ruling.digital/git' + puts 'changing remote url' + system("cd #{ENV['PWD']} && git remote set-url #{git_remote} https://ruling.digital/git") +end all_template.each do |folder| if !folder.include?('mobile') begin diff --git a/temp_file/Gemfile b/temp_file/Gemfile index 7c6f1ea..bc1ed2d 100644 --- a/temp_file/Gemfile +++ b/temp_file/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -#test!!!!!!!! +#test1!!!!!!!! #social gems gem "omniauth-google-oauth2" diff --git a/temp_file/playground_controller.rb b/temp_file/playground_controller.rb index 120046c..bccfaab 100644 --- a/temp_file/playground_controller.rb +++ b/temp_file/playground_controller.rb @@ -140,7 +140,10 @@ class Admin::PlaygroundController < OrbitAdminController end mul.status['alive'] = false mul.save - Bundler.with_clean_env{system("kill -s USR2 `cat tmp/pids/unicorn.pid`")} + if command == 'bundle update' + system('sleep 2') + Bundler.with_clean_env{system("kill -s USR2 `cat tmp/pids/unicorn.pid`")} + end end rescue => e mul.status['alive'] = false