Class: Pione::Package::PackageReader

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

Overview

PackageReader is a reader for packages.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ PackageReader

Returns a new instance of PackageReader.



21
22
23
24
25
# File 'lib/pione/package/package-reader.rb', line 21

def initialize(location)
  @location = location
  @local = nil
  @package_info = read_package_info
end

Class Method Details

.read(location) ⇒ Object

Read a pacakge from the location.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pione/package/package-reader.rb', line 7

def read(location)
  case PackageTypeClassifier.classify(location)
  when :directory
    DirectoryPackageReader.new(location).read
  when :git
    GitPackageReader.new(location).read
  when :archive
    ArchivePackageReader.new(location).read
  when :document
    SingleDocumentPackageReader.new(location).read
  end
end

Instance Method Details

#readObject

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/pione/package/package-reader.rb', line 27

def read
  raise NotImplementedError
end