fix some error
This commit is contained in:
parent
19a89ee60f
commit
d9417bc15c
|
@ -20,14 +20,18 @@ 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'
|
||||||
unity_text = File.read(folder+'assets/stylesheets/template/base/_unity.scss') rescue ''
|
unity_text = File.open(folder+'assets/stylesheets/template/base/_unity.scss','r:UTF-8') do |f|
|
||||||
|
f.read
|
||||||
|
end rescue ''
|
||||||
if unity_text.split(/\n/).join.strip.empty?
|
if unity_text.split(/\n/).join.strip.empty?
|
||||||
File.open(folder+'assets/stylesheets/template/base/_unity.scss', 'a') do |file|
|
File.open(folder+'assets/stylesheets/template/base/_unity.scss', 'a') do |file|
|
||||||
file.puts "@charset \"utf-8\";\n\n@import \"variables\";\n\n// Title\n.unity-title {\n margin: 0.5em 0;\n line-height: 1.5;\n font-family: $main-font;\n font-size: $font-h1;\n\n .layout-footer & {\n margin-bottom: 10px;\n border-bottom: none;\n\n span {\n display: inline;\n margin-bottom: 0;\n border-bottom: none;\n }\n }\n}\n\n.status {\n font-family: $main-font;\n font-size: 0.75rem;\n}\n\n.status-top {\n background-color: $theme-color-second;\n}\n\n.status-hot {\n background-color: $theme-color-third;\n}\n\n.status-source {\n background-color: $theme-color-main;\n\n a {\n color: $theme-white;\n }\n}\n"
|
file.puts "@charset \"utf-8\";\n\n@import \"variables\";\n\n// Title\n.unity-title {\n margin: 0.5em 0;\n line-height: 1.5;\n font-family: $main-font;\n font-size: $font-h1;\n\n .layout-footer & {\n margin-bottom: 10px;\n border-bottom: none;\n\n span {\n display: inline;\n margin-bottom: 0;\n border-bottom: none;\n }\n }\n}\n\n.status {\n font-family: $main-font;\n font-size: 0.75rem;\n}\n\n.status-top {\n background-color: $theme-color-second;\n}\n\n.status-hot {\n background-color: $theme-color-third;\n}\n\n.status-source {\n background-color: $theme-color-main;\n\n a {\n color: $theme-white;\n }\n}\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
filename = folder+'assets/stylesheets/template/base/_variables.scss'
|
filename = folder+'assets/stylesheets/template/base/_variables.scss'
|
||||||
texts = File.read(filename)
|
texts = File.open(filename,'r:UTF-8') do |f|
|
||||||
|
f.read
|
||||||
|
end
|
||||||
regex_pattern = /.response-content[^{]*{[^}]*@media[^{]*{[^{]*}[^{]*@media[^{]*{[^{]*}[^}]*}[^}]*}/m
|
regex_pattern = /.response-content[^{]*{[^}]*@media[^{]*{[^{]*}[^{]*@media[^{]*{[^{]*}[^}]*}[^}]*}/m
|
||||||
if !texts.include? "$font-h1:"
|
if !texts.include? "$font-h1:"
|
||||||
texts = "$font-h1: 1.5rem;\n$font-h2: 1.35rem;\n$font-h3: 1.2rem;\n$font-h4: 1.1rem;\n$font-h5: 1rem;\n$font-h6: 0.9rem;\n\n" + texts
|
texts = "$font-h1: 1.5rem;\n$font-h2: 1.35rem;\n$font-h3: 1.2rem;\n$font-h4: 1.1rem;\n$font-h5: 1rem;\n$font-h6: 0.9rem;\n\n" + texts
|
||||||
|
@ -84,26 +88,6 @@ if old_gemfile_text != new_gemfile_text
|
||||||
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]}
|
||||||
Bundler.with_clean_env{%x[cp -f '#{app_path}'/temp_file/Gemfile '#{env_pwd}'/Gemfile]}
|
Bundler.with_clean_env{%x[cp -f '#{app_path}'/temp_file/Gemfile '#{env_pwd}'/Gemfile]}
|
||||||
old_playground = File.read (env_pwd+'/app/controllers/admin/playground_controller.rb') rescue ''
|
|
||||||
new_playground = File.read (app_path+'/temp_file/playground_controller.rb') rescue ''
|
|
||||||
command2 = ''
|
|
||||||
if old_playground != new_playground
|
|
||||||
puts 'updating playground'
|
|
||||||
command2 = "cp -f #{app_path}/temp_file/playground_controller.rb #{env_pwd}/app/controllers/admin/playground_controller.rb ;"
|
|
||||||
#File.open(ENV['PWD']+'/app/controllers/admin/playground_controller.rb', 'w') do |file|
|
|
||||||
# file.write new_playground
|
|
||||||
#end
|
|
||||||
end
|
|
||||||
old_multithread = File.read (env_pwd+'/app/models/multithread.rb') rescue ''
|
|
||||||
new_multithread = File.read (app_path+'/temp_file/multithread.rb') rescue ''
|
|
||||||
command3 = ''
|
|
||||||
if old_multithread != new_multithread
|
|
||||||
puts 'updating multithread'
|
|
||||||
command3 = "cp -f #{app_path}/temp_file/multithread.rb #{env_pwd}/app/models/multithread.rb ;"
|
|
||||||
#File.open(ENV['PWD']+'/app/models/multithread.rb', 'w') do |file|
|
|
||||||
# file.write new_multithread
|
|
||||||
#end
|
|
||||||
end
|
|
||||||
command4 = "cp -rf #{app_path}/temp_file/app #{env_pwd}"
|
command4 = "cp -rf #{app_path}/temp_file/app #{env_pwd}"
|
||||||
log_development = File.mtime(env_pwd+'/log/development.log').strftime('%Y%m%d%H%M').to_i rescue 0
|
log_development = File.mtime(env_pwd+'/log/development.log').strftime('%Y%m%d%H%M').to_i rescue 0
|
||||||
log_production = File.mtime(env_pwd+'/log/production.log').strftime('%Y%m%d%H%M').to_i rescue 0
|
log_production = File.mtime(env_pwd+'/log/production.log').strftime('%Y%m%d%H%M').to_i rescue 0
|
||||||
|
@ -140,7 +124,7 @@ if old_gemfile_text != new_gemfile_text
|
||||||
f.puts exist_str
|
f.puts exist_str
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
all_command = "#{install_cmd} #{command1} ; #{command2} #{command3} #{command4} "
|
all_command = "#{install_cmd} #{command1} ; #{command4} "
|
||||||
watch_dog_cmd = "watch -n 30 \"unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now\""
|
watch_dog_cmd = "watch -n 30 \"unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now\""
|
||||||
#file = File.new(File.join(env_pwd,'bundle_update_background.sh'),"w")
|
#file = File.new(File.join(env_pwd,'bundle_update_background.sh'),"w")
|
||||||
#file.write(all_command)
|
#file.write(all_command)
|
||||||
|
@ -158,6 +142,8 @@ 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
|
||||||
|
system("cp -rf #{app_path}/temp_file/app #{env_pwd}")
|
||||||
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|
|
||||||
|
|
|
@ -172,7 +172,7 @@ class Admin::PlaygroundController < OrbitAdminController
|
||||||
def restart_unicorn(mode)
|
def restart_unicorn(mode)
|
||||||
mode = Rails.env if mode.nil?
|
mode = Rails.env if mode.nil?
|
||||||
unicorn_rails = %x[which unicorn_rails].sub("\n",'')
|
unicorn_rails = %x[which unicorn_rails].sub("\n",'')
|
||||||
content = "kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode} | at now"
|
content = "kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && sleep 1 && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode} | at now"
|
||||||
Thread.new do
|
Thread.new do
|
||||||
Bundler.with_clean_env{system(content)}
|
Bundler.with_clean_env{system(content)}
|
||||||
end
|
end
|
|
@ -170,12 +170,9 @@ class Admin::SitesController < OrbitAdminController
|
||||||
git_add_except_public = Dir['*'].select{|v| v!= 'public'}.collect do |v|
|
git_add_except_public = Dir['*'].select{|v| v!= 'public'}.collect do |v|
|
||||||
"#{git} add -f '#{v}'"
|
"#{git} add -f '#{v}'"
|
||||||
end.join(' && ')
|
end.join(' && ')
|
||||||
git_add_custom = (Dir['*'].select{|v| v!= 'Gemfile' && v !='app' && v != 'lib' && v != 'config' && v != 'public'} + ['app/templates','config/mongoid.yml']).collect do |v|
|
git_add_custom = (Dir['*'].select{|v| v !='app' && v != 'lib' && v != 'config' && v != 'public'} + ['app/templates','config/mongoid.yml']).collect do |v|
|
||||||
"#{git} add -f --all '#{v}'"
|
"#{git} add -f --all '#{v}'"
|
||||||
end.join(' && ')
|
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}'"
|
|
||||||
end.join(' && ')
|
|
||||||
git_restore = "#{git} checkout ."
|
git_restore = "#{git} checkout ."
|
||||||
time_now = Time.now.strftime('%Y_%m_%d_%H_%M')
|
time_now = Time.now.strftime('%Y_%m_%d_%H_%M')
|
||||||
if %x[git config user.name].empty?
|
if %x[git config user.name].empty?
|
||||||
|
@ -184,7 +181,7 @@ class Admin::SitesController < OrbitAdminController
|
||||||
if %x[git config user.email].empty?
|
if %x[git config user.email].empty?
|
||||||
%x[git config --global user.email "orbit@rulingcom.com"]
|
%x[git config --global user.email "orbit@rulingcom.com"]
|
||||||
end
|
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_custom} && #{git_restore} && #{git_add_except_public}&& #{git} commit -m complete_#{type}_#{time_now} && cp -rf public/assets public/assets_back && rm -rf public/assets")}
|
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')
|
mul.update_attributes(status: 'finish')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue