Sha256: 6fa6b3e0b20dea595aaa8d5b6c8bd7885950c7e2ed6c2b9086529611b984f8a7

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 Bytes

Contents

module Pione
  module Component
    # PackageExpander expands package files from archive.
    class PackageExpander
      attr_reader :location

      # @param location [BasicLoaction]
      #   package location
      def initialize(location)
        @location = location
      end

      def expand(output)
        location = @location.local

        # expand
        Zip::Archive.open(location.path.to_s) do |ar|
          ar.each do |file|
            unless file.directory?
              (output + file.name).write(file.read)
            end
          end
        end
      end

      private

      def valid_filename?
        filename = @location.basename
        if File.extname(filename) == ".ppg"
          identifiers = filename.split("-")
          identifiers[1]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pione-0.2.2 lib/pione/component/package-expander.rb