Repository: GoogleContainerTools/krew (go)

Issue:
Proposal: Add Homepage, License and Author fields to Plugin
I propose new three fields for Plugin.

- `spec.homepage`:  *Optional* project homepage, only for documentation purposes
    - Motivation: When I find bugs in a plugin, I’d like to know the repository of the plugin easily in order to send an issue.
- `spec.license`: *Optional* license such as Apache-2.0 or MIT, only for documentation purposes
    - Motivation: When I find a plugin as it seems convenient, I’d like to know the license of the plugin easily.
- `spec.author`: *Optional* project author, only for documentation purposes
    - Motivation: When I find an awesome plugin, I’d like to know the author of the plugin easily.

Along with adding the new fields, `krew info` command will be changed to show homepage, license, and author as follows:

```
$ kubectl krew info krew
NAME: krew
URI: https://storage.googleapis.com/krew/v0.2.1/krew.tar.gz
SHA256: dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a
VERSION: v0.2.1
HOMEPAGE: https://github.com/GoogleContainerTools/krew
LICENSE: Apache-2.0
AUTHOR: https://github.com/ahmetb
CAVEATS:
\
 |  krew is now installed! To start using kubectl plugins, you need to add
 |  krew's installation directory to your PATH:
 |    * macOS/Linux:
 |      - Add the following to your ~/.bashrc or ~/.zshrc:
 |          export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
 |      - Restart your shell.
 |    * Windows: Add %USERPROFILE%\.krew\bin to your PATH environment variable
 |  Run "kubectl krew" to list krew commands and get help.
 |  You can find documentation at https://github.com/GoogleContainerTools/krew.
/
```

The below is `krew.yaml` which is added the new three fields:

```diff
diff --git a/plugins/krew.yaml b/plugins/krew.yaml
index dca2408..e811ac0 100644
--- a/plugins/krew.yaml
+++ b/plugins/krew.yaml
@@ -19,6 +19,9 @@ metadata:
 spec:
   version: "v0.2.1"
   shortDescription: Package manager for kubectl plugins.
+  homepage: https://github.com/GoogleContainerTools/krew
+  license: Apache-2.0
+  author: https://github.com/ahmetb
   caveats: |
     krew is now installed! To start using kubectl plugins, you need to add
     krew's installation directory to your PATH:
```

https://github.com/superbrothers/krew/tree/homepage-license-author is PoC of this proposal.

Pull request description:
Add `spec.homepage` field to the plugin manifest
This PR adds `spec.homepage` field to the plugin manifest.

/close #157 

---

The `spec.homepage` field of the plugin manifest defines the url of the
plugin project homepage. The field value should be a valid url.

In addition, if the `spec.homepage` field is defined in plugin manifest,
`kubectl krew info` command displays that field value as HOMEPAGE as follows:

    $ kubectl krew info krew
    NAME: krew
    URI: https://storage.googleapis.com/krew/v0.2.1/krew.tar.gz
    SHA256: dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a
    VERSION: v0.2.1
    HOMEPAGE: https://github.com/GoogleContainerTools/krew
    ...

Patch:
diff --git a/cmd/krew/cmd/info.go b/cmd/krew/cmd/info.go
index 54ba4c2..e4dd856 100644
--- a/cmd/krew/cmd/info.go
+++ b/cmd/krew/cmd/info.go
@@ -68,12 +68,15 @@ func printPluginInfo(out io.Writer, plugin index.Plugin) {
 			fmt.Fprintf(out, "SHA256: %s\n", platform.Sha256)
 		}
 	}
-	if plugin.Spec.Description != "" {
-		fmt.Fprintf(out, "DESCRIPTION: \n%s\n", plugin.Spec.Description)
-	}
 	if plugin.Spec.Version != "" {
 		fmt.Fprintf(out, "VERSION: %s\n", plugin.Spec.Version)
 	}
+	if plugin.Spec.Homepage != "" {
+		fmt.Fprintf(out, "HOMEPAGE: %s\n", plugin.Spec.Homepage)
+	}
+	if plugin.Spec.Description != "" {
+		fmt.Fprintf(out, "DESCRIPTION: \n%s\n", plugin.Spec.Description)
+	}
 	if plugin.Spec.Caveats != "" {
 		fmt.Fprintln(out, prepCaveats(plugin.Spec.Caveats))
 	}
diff --git a/docs/DEVELOPER_GUIDE.md b/docs/DEVELOPER_GUIDE.md
index 00f4dc1..1bf7743 100644
--- a/docs/DEVELOPER_GUIDE.md
+++ b/docs/DEVELOPER_GUIDE.md
@@ -109,6 +109,7 @@ spec:
       to: "."               # '.' refers to the root of plugin install directory
     bin: "./kubectl-foo"  # path to the plugin executable after copying files above
   shortDescription: Prints the environment variables.
+  homepage: https://github.com/GoogleContainerTools/krew # optional, url for the project homepage
   # (optional) use caveats field to show post-installation recommendations
   caveats: |
     This plugin needs the following programs:
diff --git a/pkg/index/types.go b/pkg/index/types.go
index 9c4c9f6..5b7f6e4 100644
--- a/pkg/index/types.go
+++ b/pkg/index/types.go
@@ -33,6 +33,7 @@ type PluginSpec struct {
 	ShortDescription string `json:"shortDescription,omitempty"`
 	Description      string `json:"description,omitempty"`
 	Caveats          string `json:"caveats,omitempty"`
+	Homepage         string `json:"homepage,omitempty"`
 
 	Platforms []Platform `json:"platforms,omitempty"`
 }


Test patch:
diff --git a/pkg/index/indexscanner/testdata/testindex/plugins/foo.yaml b/pkg/index/indexscanner/testdata/testindex/plugins/foo.yaml
index 4f050cb..3fa8555 100644
--- a/pkg/index/indexscanner/testdata/testindex/plugins/foo.yaml
+++ b/pkg/index/indexscanner/testdata/testindex/plugins/foo.yaml
@@ -33,4 +33,4 @@ spec:
       matchLabels:
         os: "windows"
   shortDescription: "exists"
-
+  homepage: "https://example.com/foo"
diff --git a/pkg/index/validate_test.go b/pkg/index/validate_test.go
index 60f4c8d..8702211 100644
--- a/pkg/index/validate_test.go
+++ b/pkg/index/validate_test.go
@@ -112,6 +112,7 @@ func TestPlugin_Validate(t *testing.T) {
 					ShortDescription: "short",
 					Description:      "",
 					Caveats:          "",
+					Homepage:         "",
 					Platforms: []Platform{{
 						Head:     "http://example.com",
 						URI:      "",