completing the code with segment fault

This commit is contained in:
Kaito 2011-08-16 12:14:01 +08:00
parent 8895b9fe20
commit d75dd4f936
2 changed files with 9 additions and 11 deletions

View File

@ -27,13 +27,10 @@ class Admin::DesignsController < ApplicationController
Zip::ZipFile.open(file) { |zip_file|
design = Design.new.from_json(zip_file.read("#{zip_name}/info.json"))
Dir.mktmpdir('f_path') { |dir|
#layout_entry =""
#struct_css_entry =""
design.build_layout
themes_entries = []
javascripts_entries = []
images_entries = []
debugger
temp_file4layout = File.new(dir + '/' + zip_name+'-1', 'w+')
temp_file4layout.binmode
#dir/zip_name
@ -60,21 +57,22 @@ class Admin::DesignsController < ApplicationController
images_entries << entry
end
end
debugger
['themes', 'javascripts', 'images'].each do |type|
eval("#{type}_entries").each do |entry|
#incompleted
eval("#{type}.entries").each do |entry|
title = File.basename entry
debugger
temp_file = File.new(dir + '/' + title+'-3', 'w+')
filename = File.basename entry.to_s
temp_file = File.new(dir + '/' + filename, 'w+')
temp_file.binmode
temp_file.write zip_file.read entry
object.file = temp_file
object.to_save = true
build_and_store = eval("design.#{type}").build
build_and_store.file = temp_file
build_and_store.file_filename = filename
build_and_store._type = (File.extname entry.to_s).delete '.'
build_and_store.to_save = true
end
end
}
design.save
}
end