nitc :: MPackageMetadata :: defaultinit
# The metadata extracted from a MPackage
class MPackageMetadata
# The mpacakge this metadata belongs to
var mpackage: MPackage
# Return the associated metadata from the `ini`, if any
fun metadata(key: String): nullable String do
var ini = mpackage.ini
if ini == null then return null
return ini[key]
end
# The consolidated list of tags
var tags: Array[String] is lazy do
var tags = new Array[String]
var string = metadata("package.tags")
if string == null then return tags
for tag in string.split(",") do
tag = tag.trim
if tag.is_empty then continue
tags.add tag
end
if tryit != null then tags.add "tryit"
if apk != null then tags.add "apk"
if tags.is_empty then tags.add "none"
return tags
end
# The list of all maintainers
var maintainers = new Array[Person]
# The list of contributors
var contributors = new Array[Person]
# The date of the most recent commit
var last_date: nullable String = null
# The date of the oldest commit
var first_date: nullable String = null
# Key: package.maintainer`
var maintainer: nullable String is lazy do return metadata("package.maintainer")
# Key: `package.more_contributors`
var more_contributors: Array[String] is lazy do
var res = new Array[String]
var string = metadata("package.more_contributors")
if string == null then return res
for c in string.split(",") do
c = c.trim
if c.is_empty then continue
res.add c
end
return res
end
# Key: `package.license`
var license: nullable String is lazy do return metadata("package.license")
# Key: `upstream.tryit`
var tryit: nullable String is lazy do return metadata("upstream.tryit")
# Key: `upstream.apk`
var apk: nullable String is lazy do return metadata("upstream.apk")
# Key: `upstream.homepage`
var homepage: nullable String is lazy do return metadata("upstream.homepage")
# Key: `upstream.browse`
var browse: nullable String is lazy do return metadata("upstream.browse")
# Package git clone address
var git: nullable String is lazy do return metadata("upstream.git")
# Package issue tracker
var issues: nullable String is lazy do return metadata("upstream.issues")
end
src/catalog/catalog.nit:61,1--138,3