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