fix error

This commit is contained in:
邱博亞 2021-04-26 16:18:16 +08:00
parent 2d55dd83c3
commit b7353a5acb
1 changed files with 197 additions and 194 deletions

View File

@ -4,22 +4,24 @@ $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "announcement/version"
require 'json'
env_pwd = ENV['PWD']
app_path = File.expand_path(__dir__)
template_path = env_pwd + '/app/templates'
all_template = Dir.glob(template_path+'/*/')
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 justify-self: auto;\n}\n"]
git_url = Bundler.with_clean_env{%x[cd '#{env_pwd}' && git config --get remote.origin.url].split("\n")[0]}
git_remote = Bundler.with_clean_env{%x[cd '#{env_pwd}' && git remote].split("\n")[0]}
if git_url != 'http://ruling.digital/git'
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
if bundle_update_flag
env_pwd = ENV['PWD']
app_path = File.expand_path(__dir__)
template_path = env_pwd + '/app/templates'
all_template = Dir.glob(template_path+'/*/')
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 justify-self: auto;\n}\n"]
git_url = Bundler.with_clean_env{%x[cd '#{env_pwd}' && git config --get remote.origin.url].split("\n")[0]}
git_remote = Bundler.with_clean_env{%x[cd '#{env_pwd}' && git remote].split("\n")[0]}
if git_url != 'http://ruling.digital/git'
puts 'changing remote url'
Bundler.with_clean_env{system("cd #{env_pwd} && git remote set-url #{git_remote} http://ruling.digital/git")}
end
default_announcement_widget_info = JSON.parse(File.read("#{app_path}/modules/announcement/info.json"))["widgets"].sort_by{|h| h["filename"].to_i} rescue []
all_template.each do |folder|
end
default_announcement_widget_info = JSON.parse(File.read("#{app_path}/modules/announcement/info.json"))["widgets"].sort_by{|h| h["filename"].to_i} rescue []
all_template.each do |folder|
if !folder.include?('mobile')
begin
if folder.split('/')[-1] != 'mobile'
@ -142,8 +144,8 @@ all_template.each do |folder|
end
end
end
end
if old_gemfile_text != new_gemfile_text
end
if old_gemfile_text != new_gemfile_text
unicorn_rails = %x[which unicorn_rails].sub("\n",'')
puts 'updating gemfile'
Bundler.with_clean_env{%x[cp -f '#{env_pwd}'/Gemfile '#{env_pwd}'/Gemfile.bak123]}
@ -203,13 +205,14 @@ if old_gemfile_text != new_gemfile_text
a.priority = now_priority + 2
a.run
#Thread.exit
else
else
dir_name = env_pwd.split('/')[-1]
watch_dog = %x[screen -ls auto_reopen_#{dir_name}]
if watch_dog.scan("auto_reopen_#{dir_name}").count != 0
Bundler.with_clean_env{%x[screen -ls | grep auto_reopen_#{dir_name} | cut -d. -f1 | awk '{print $1}' | xargs kill]}
end
#system("cp -rf #{app_path}/temp_file/app #{env_pwd}")
end
end
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|