Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop
This commit is contained in:
commit
399d7b559a
|
@ -7,7 +7,8 @@ class TestController < ApplicationController
|
|||
|
||||
bid.homeworks.each do |homeattach|
|
||||
homeattach.attachments.each do |attach|
|
||||
homeworks_attach_path << attach.disk_filename
|
||||
length = attach.storage_path.length
|
||||
homeworks_attach_path << attach.diskfile.to_s.slice((length+1)..-1)
|
||||
end
|
||||
end
|
||||
@paths = homeworks_attach_path
|
||||
|
@ -24,13 +25,13 @@ class TestController < ApplicationController
|
|||
def ziping files_path
|
||||
folder = "#{Rails.root}/files"
|
||||
input_filename = files_path
|
||||
zipfile_name = "#{Rails.root}/tmp/archive_#{Time.now.to_i}.zip"
|
||||
zipfile_name = "#{Rails.root}/tmp/archiveZip/archive_#{Time.now.to_i}.zip"
|
||||
|
||||
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
||||
input_filename.each do |filename|
|
||||
zipfile.add(filename, folder + '/' + filename)
|
||||
zipfile.add(filename.split('/').last, folder + '/' + filename)
|
||||
end
|
||||
zipfile.get_ouput_stream("ReadMe"){ |os|
|
||||
zipfile.get_output_stream("ReadMe"){ |os|
|
||||
os.write "Homeworks"
|
||||
}
|
||||
end
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
desc "nyan ruby zip operation"
|
||||
task :zip do
|
||||
puts "will building zip tmp files sweeper."
|
||||
end
|
||||
|
||||
namespace :zip do
|
||||
desc "ruby zip sweeper"
|
||||
task :rubyzip_clean do
|
||||
puts "ruby zip sweeping..."
|
||||
end
|
||||
end
|
||||
|
||||
desc "create tmp file, to test"
|
||||
file 'tmp/test.yml' do
|
||||
require 'yaml'
|
||||
var = {
|
||||
:name => "name",
|
||||
:age => "age",
|
||||
:agent => "agent"
|
||||
}
|
||||
File.open('tmp/test.yml', 'w') do |f|
|
||||
f.write YAML.dump({'conf' => var })
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue