mpackages_stats[mpackage] = stats
return stats
end
+
+ # Compose catalog stats
+ var catalog_stats: CatalogStats is lazy do
+ var stats = new CatalogStats
+ stats.packages = mpackages.length
+ stats.maintainers = maint2proj.length
+ stats.contributors = contrib2proj.length
+ stats.tags = tag2proj.length
+ stats.modules = mmodules.sum
+ stats.classes = mclasses.sum
+ stats.methods = mmethods.sum
+ stats.loc = loc.sum
+ return stats
+ end
+end
+
+# Catalog statistics
+class CatalogStats
+
+ # Number of packages
+ var packages = 0
+
+ # Number of maintainers
+ var maintainers = 0
+
+ # Number of contributors
+ var contributors = 0
+
+ # Number of tags
+ var tags = 0
+
+ # Number of modules
+ var modules = 0
+
+ # Number of classes
+ var classes = 0
+
+ # Number of methods
+ var methods = 0
+
+ # Number of line of codes
+ var loc = 0
end
# MPackage statistics for the catalog
var score = 0
end
+# Sort the mpackages by their score
+class CatalogScoreSorter
+ super Comparator
+
+ # Catalog used to access scores
+ var catalog: Catalog
+
+ redef type COMPARED: MPackage
+
+ redef fun compare(a, b) do
+ if not catalog.mpackages_stats.has_key(a) then return 1
+ if not catalog.mpackages_stats.has_key(b) then return -1
+ var astats = catalog.mpackages_stats[a]
+ var bstats = catalog.mpackages_stats[b]
+ return bstats.score <=> astats.score
+ end
+end
+
+# Sort tabs alphabetically
+class CatalogTagsSorter
+ super Comparator
+
+ redef type COMPARED: String
+
+ redef fun compare(a, b) do return a <=> b
+end
+
# Execute a git command and return the result
fun git_run(command: String...): String
do