add git clone

This commit is contained in:
2022-11-02 20:25:55 +01:00
parent ebc2d7aa8f
commit bace568ad5
12 changed files with 125 additions and 22 deletions

View File

@@ -2,6 +2,8 @@ package schema
import (
"context"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"regexp"
@@ -10,6 +12,11 @@ import (
type CharSchemaPluginName string
func (cspn CharSchemaPluginName) Hash() string {
bytes := sha256.Sum256([]byte(cspn))
return hex.EncodeToString(bytes[:])
}
type PluginOps struct {
Org string
RepositoryName string

View File

@@ -55,16 +55,16 @@ func TestGetPlugins(t *testing.T) {
input: `
registry: git.front.kjuulh.io
plugins:
"kjuulh/char#plugins/gocli": {}
"kjuulh/char#plugins/gocli@v1.9.0": {}
"kjuulh/char#plugins/rust": {}
`,
expected: map[schema.CharSchemaPluginName]*schema.CharSchemaPlugin{
"kjuulh/char#plugins/gocli": {
"kjuulh/char#plugins/gocli@v1.9.0": {
Opts: &schema.PluginOps{
Org: "kjuulh",
RepositoryName: "char",
Path: "plugins/gocli",
Version: "",
Version: "v1.9.0",
},
},
"kjuulh/char#plugins/rust": {