Sha256: 3c16c5be1d49048ed3bd949cfac4a15030127404378cc8bdf78e2597547f14e3
Contents?: true
Size: 839 Bytes
Versions: 1
Compression:
Stored size: 839 Bytes
Contents
require 'zip/zip' module ETL module Processor # Custom processor to zip files class ZipFileProcessor < ETL::Processor::Processor attr_reader :infile attr_reader :destination # configuration options include: # * infile - File to zip (required) # * destination - Zip file name (default: #{infile}.zip) def initialize(control, configuration) path = Pathname.new(configuration[:infile]) @infile = path.absolute? ? path : Pathname.new(File.dirname(File.expand_path(configuration[:infile]))) + path @destination = configuration[:destination] || "#{infile}.zip" end def process Zip::ZipFile.open(@destination, Zip::ZipFile::CREATE) do |zipfile| zipfile.add(@infile.basename, @infile) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activewarehouse-etl-0.9.5.rc1 | lib/etl/processor/zip_file_processor.rb |