module Pione::Package::PackageTypeClassifier
PackageTypeClassifier
provides the function to distinguish package types.
Public Class Methods
classify(location)
click to toggle source
Distinguish the type of package based on the location.
@param [BasicLocation]
location of the package
@return [Symbol]
package type
# File lib/pione/package/package-reader.rb, line 70 def classify(location) return :git if git?(location) return :archive if archive?(location) return :document if document?(location) return :directory end
Private Class Methods
archive?(location)
click to toggle source
Return true if the location represents archive package.
# File lib/pione/package/package-reader.rb, line 85 def archive?(location) location.file? and location.extname == ".ppg" end
document?(location)
click to toggle source
Return true if the location represents document package.
# File lib/pione/package/package-reader.rb, line 90 def document?(location) location.file? and location.extname == ".pione" end
git?(location)
click to toggle source
Return true if the location represents git package.
# File lib/pione/package/package-reader.rb, line 80 def git?(location) location.location_type == :git_repository end