Vanity overhaul #3

Merged
jolheiser merged 1 commits from refs/pull/3/head into master 2020-09-12 15:23:28 +00:00
5 changed files with 19 additions and 5 deletions

View File

@ -200,5 +200,18 @@ func Before(ctx *cli.Context) error {
beaver.Console.Level = beaver.DEBUG beaver.Console.Level = beaver.DEBUG
} }
beaver.Debugf("Port: %d", Port)
beaver.Debugf("Domain: %s", Domain)
beaver.Debugf("Service: %s", Service)
beaver.Debugf("Base URL: %s", baseURL)
beaver.Debugf("Namespace: %s", Namespace)
beaver.Debugf("Include: %s", include.Value())
beaver.Debugf("Exclude: %s", exclude.Value())
beaver.Debugf("Private: %t", Private)
beaver.Debugf("Fork: %t", Fork)
beaver.Debugf("Mirror: %t", Mirror)
beaver.Debugf("Archive: %t", Archive)
beaver.Debugf("Override: %s", override.Value())
beaver.Debugf("Interval: %s", Interval)
return nil return nil
} }

View File

@ -63,6 +63,7 @@ func doVanity(res http.ResponseWriter, req *http.Request) {
if err := vanity.Execute(res, map[string]interface{}{ if err := vanity.Execute(res, map[string]interface{}{
"Package": pkg, "Package": pkg,
"Module": pkg.Module(flags.Domain),
"AppVer": api.Version, "AppVer": api.Version,
"GoVer": runtime.Version(), "GoVer": runtime.Version(),
"GoSource": fmt.Sprintf("%s %s %s %s", pkg.Module(flags.Domain), pkg.CloneHTTP, svc.GoDir(pkg), svc.GoFile(pkg)), "GoSource": fmt.Sprintf("%s %s %s %s", pkg.Module(flags.Domain), pkg.CloneHTTP, svc.GoDir(pkg), svc.GoFile(pkg)),

View File

@ -11,7 +11,7 @@ var Head = `
<meta name="og:description" content="{{.Package.Description}}"/> <meta name="og:description" content="{{.Package.Description}}"/>
<!-- Go --> <!-- Go -->
<meta name="go-import" content="{{.Package.Module}} git {{.Package.CloneHTTP}}"/> <meta name="go-import" content="{{.Module}} git {{.Package.CloneHTTP}}"/>
<meta name="go-source" content="{{.GoSource}}"> <meta name="go-source" content="{{.GoSource}}">
<!-- Git Import --> <!-- Git Import -->

View File

@ -6,5 +6,5 @@ var Vanity = `
<p><strong>Name: </strong>{{.Package.Name}}</p> <p><strong>Name: </strong>{{.Package.Name}}</p>
<p><strong>Source: </strong><a href="{{.Package.WebURL}}">{{.Package.WebURL}}</a></p> <p><strong>Source: </strong><a href="{{.Package.WebURL}}">{{.Package.WebURL}}</a></p>
{{if .Package.Description}}<p><strong>Description: </strong>{{.Package.Description}}</p>{{end}} {{if .Package.Description}}<p><strong>Description: </strong>{{.Package.Description}}</p>{{end}}
<p><strong>Documentation: <a href="https://pkg.go.dev/{{.Package.Module}}">https://pkg.go.dev/{{.Package.Module}}</a></strong></p> <p><strong>Documentation: <a href="https://pkg.go.dev/{{.Module}}">https://pkg.go.dev/{{.Module}}</a></strong></p>
` `

View File

@ -53,7 +53,7 @@ func Check(pkg *api.Package) error {
// Exclusions // Exclusions
for _, exclude := range flags.Exclude { for _, exclude := range flags.Exclude {
if exclude.MatchString(pkg.Name) { if exclude.MatchString(pkg.Name) {
return fmt.Errorf("%s is was excluded by the rule %s", pkg.Name, exclude.String()) return fmt.Errorf("%s was excluded by the rule %s", pkg.Name, exclude.String())
} }
} }
@ -61,10 +61,10 @@ func Check(pkg *api.Package) error {
if len(flags.Include) > 0 { if len(flags.Include) > 0 {
for _, include := range flags.Include { for _, include := range flags.Include {
if include.MatchString(pkg.Name) { if include.MatchString(pkg.Name) {
return fmt.Errorf("%s is was included by the rule %s", pkg.Name, include.String()) return fmt.Errorf("%s was included by the rule %s", pkg.Name, include.String())
} }
} }
return fmt.Errorf("%s is wasn't included by any existing inclusion rule", pkg.Name) return fmt.Errorf("%s wasn't included by any existing inclusion rule", pkg.Name)
} }
return nil return nil