Class: Pione::Package::PackageScanner
- Inherits:
-
Object
- Object
- Pione::Package::PackageScanner
- Defined in:
- lib/pione/package/package-scanner.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(location) ⇒ PackageScanner
constructor
A new instance of PackageScanner.
-
#scan ⇒ Object
Scan the package location and return package informations.
Constructor Details
#initialize(location) ⇒ PackageScanner
Returns a new instance of PackageScanner.
10 11 12 |
# File 'lib/pione/package/package-scanner.rb', line 10 def initialize(location) @package_location = location end |
Class Method Details
.scan(location) ⇒ Object
5 6 7 |
# File 'lib/pione/package/package-scanner.rb', line 5 def scan(location) new(location).scan end |
Instance Method Details
#scan ⇒ Object
Scan the package location and return package informations.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/pione/package/package-scanner.rb', line 15 def scan if @package_location.directory? documents = scan_documents(@package_location) name, editor, tag, parents = scan_annotations(documents) scenarios = scan_scenarios(@package_location) bins = scan_bins(@package_location) etcs = scan_etcs(@package_location) return PackageInfo.new( name: name, editor: editor, tag: tag, parents: parents, documents: documents, scenarios: scenarios, bins: bins, etcs: etcs ) else # the case for single document package name, editor, tag, parents = scan_annotations([@package_location]) documents = [@package_location.basename] return PackageInfo.new( name: name, editor: editor, tag: tag, parents: parents, documents: documents ) end end |