Class: Pione::Package::ArchivePackageReader

Inherits:
PackageReader show all
Defined in:
lib/pione/package/package-reader.rb

Overview

ArchivePackageReader is a reader for PPG pakage.

Instance Method Summary collapse

Methods inherited from PackageReader

read

Constructor Details

#initialize(location) ⇒ ArchivePackageReader

Returns a new instance of ArchivePackageReader.



166
167
168
# File 'lib/pione/package/package-reader.rb', line 166

def initialize(location)
  @location = location # arbitrary data location
end

Instance Method Details

#readObject



170
171
172
173
174
175
176
177
178
179
180
# File 'lib/pione/package/package-reader.rb', line 170

def read
  # copy to local, we cannot use Location::DataLocation#local in here
  # because the method don't keep filename
  local_location = Location[Temppath.mkdir] + @location.basename
  @location.copy(local_location)

  # cache the package
  digest = PackageCache.cache(local_location)

  return PackageHandler.new(PackageCache.directory_cache(digest), digest: digest)
end