Add log info for asking restart after app module installed
This commit is contained in:
parent
84ebc8306b
commit
5c3ae104f0
|
@ -89,53 +89,27 @@ class Admin::PurchasesController < ApplicationController
|
||||||
destination = "#{Rails.root}/vendor/plugins"
|
destination = "#{Rails.root}/vendor/plugins"
|
||||||
|
|
||||||
Zip::ZipFile.open(file) do |zip_file|
|
Zip::ZipFile.open(file) do |zip_file|
|
||||||
# encrypted = {}
|
|
||||||
# ['encrypted_data', 'encrypted_key', 'encrypted_iv'].each do |e|
|
|
||||||
# encrypted.merge!(e => zip_file.read(e))
|
|
||||||
# end
|
|
||||||
# orig_file = decrypt_data(encrypted['encrypted_data'], encrypted['encrypted_key'], encrypted['encrypted_iv'])
|
|
||||||
orig_file = file
|
orig_file = file
|
||||||
|
|
||||||
temp_file = Tempfile.new("temp_file_zip")
|
temp_file = Tempfile.new("temp_file_zip")
|
||||||
# debugger
|
|
||||||
temp_file.binmode
|
temp_file.binmode
|
||||||
temp_file.write orig_file
|
temp_file.write orig_file
|
||||||
temp_file.rewind
|
temp_file.rewind
|
||||||
|
|
||||||
|
|
||||||
# Zip::ZipFile.open(temp_file) { |orig_zip|
|
|
||||||
app = AppModule.new.from_json(zip_file.read("#{zip_name}/#{zip_name}/#{zip_name}.json"))
|
app = AppModule.new.from_json(zip_file.read("#{zip_name}/#{zip_name}/#{zip_name}.json"))
|
||||||
|
zip_file.each do |f|
|
||||||
zip_file.each { |f|
|
|
||||||
|
|
||||||
if (f.to_s=~/^#{zip_name}\/#{zip_name}\/*/)
|
if (f.to_s=~/^#{zip_name}\/#{zip_name}\/*/)
|
||||||
# debugger
|
|
||||||
f_path=File.join(destination, f.name.gsub(/^#{zip_name}\//, ''))
|
f_path=File.join(destination, f.name.gsub(/^#{zip_name}\//, ''))
|
||||||
FileUtils.mkdir_p(File.dirname(f_path))
|
FileUtils.mkdir_p(File.dirname(f_path))
|
||||||
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
||||||
end
|
end
|
||||||
}
|
end
|
||||||
|
|
||||||
# unzip_file(file, "#{Rails.root}/vendor/plugins")
|
log = Logger.new(STDOUT)
|
||||||
|
log.level = Logger::WARN
|
||||||
# Dir.mktmpdir('f_path') { |dir|
|
log.warn("App unzip procress is finished,please restart the server to apply effect")
|
||||||
#
|
|
||||||
# build_file(orig_zip, zip_name, dir)
|
|
||||||
|
|
||||||
# build_file(orig_zip, zip_name, dir, design.default_css) if design.default_css
|
|
||||||
# build_file(orig_zip, zip_name, dir, design.reset_css) if design.reset_css
|
|
||||||
|
|
||||||
# ['themes', 'javascripts', 'images'].each do |type|
|
|
||||||
# design.send(type).each do |object|
|
|
||||||
# build_file(orig_zip, zip_name, dir, object, type)
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# }
|
|
||||||
# temp_file.close
|
|
||||||
# temp_file.unlink
|
|
||||||
# # design.save
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
#TODO Perform touch tmp/restart to restart in production env
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue