tests/thirdparty: multiple packages per project (#262)

This commit is contained in:
Michael McLoughlin
2022-04-24 20:20:11 -07:00
committed by GitHub
parent 96c4d85995
commit 84071ae4f9
14 changed files with 1051 additions and 894 deletions

View File

@@ -32,7 +32,7 @@ var (
typ = flag.String("type", "", "documentation type")
tmpl = flag.String("tmpl", "", "explicit template file (overrides -type)")
output = flag.String("output", "", "path to output file (default stdout)")
pkgsfilename = flag.String("pkgs", "", "packages configuration")
prjsfilename = flag.String("prjs", "", "projects configuration")
)
func mainerr() (err error) {
@@ -57,19 +57,19 @@ func mainerr() (err error) {
return err
}
// Load third-party packages.
if *pkgsfilename == "" {
return errors.New("missing packages configuration")
// Load third-party projects.
if *prjsfilename == "" {
return errors.New("missing projects configuration")
}
pkgs, err := thirdparty.LoadPackagesFile(*pkgsfilename)
prjs, err := thirdparty.LoadProjectsFile(*prjsfilename)
if err != nil {
return err
}
// Execute.
data := map[string]interface{}{
"Packages": pkgs,
"Projects": prjs,
}
var buf bytes.Buffer

View File

@@ -1,7 +1,6 @@
# Adopters
{{ range .Packages.Ranked }}
{{ range .Projects.Ranked }}
{{ avatar .Repository.Owner 28 }} [{{ .Repository.Owner }} / **{{ .Repository.Name }}**]({{ .Repository.URL }})
{{- if .SubPackage }} / **{{ .SubPackage}}**{{ end }}
{{ .Metadata.Description }}
{{ end -}}

View File

@@ -105,10 +105,9 @@ Implementations of full algorithms:
Popular projects using `avo`:
{{ range .Packages.Top 10 -}}
{{ range .Projects.Top 10 -}}
{{ if lt .Metadata.Stars 100 }}{{break}}{{ end -}}
{{ avatar .Repository.Owner 24 }} [{{ .Repository.Owner }} / **{{ .Repository.Name }}**]({{ .Repository.URL }})
{{- if .SubPackage }} / **{{ .SubPackage}}**{{ end }}
:star: {{ .Metadata.Stars }}
> {{ .Metadata.Description }}