Class: HomeWorkChecker::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hw_checker/base.rb

Class Method Summary collapse

Class Method Details

.start(archive_path, result_path, name, type, tmp_path = '/tmp') ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/hw_checker/base.rb', line 3

def self.start(archive_path, result_path, name, type, tmp_path = '/tmp')
  `rm -r #{tmp_path}/#{name}` if Dir.exist?("#{tmp_path}/#{name}")
  time_start, xml_content = Time.now, {} 
  Unarchive::Zip.new("#{archive_path}/#{name+type}", tmp_path)   
  stats = ArchiveResult.execute(tmp_path, name)
  stats << (Time.now - time_start).round(2)

  File.open("#{result_path}/#{name}.xml", 'w') do |file| 
    file.write(generate_xml_content(name, stats) )
  end
end