2021-11-30 12:04:28 +01:00
|
|
|
package helm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
const K = "katenary.io"
|
2022-02-14 14:37:09 +01:00
|
|
|
|
2021-12-05 09:05:48 +01:00
|
|
|
var (
|
2022-05-08 09:55:25 +02:00
|
|
|
Appname = "" // set at runtime
|
2021-12-05 09:05:48 +01:00
|
|
|
Version = "1.0" // should be set from main.Version
|
|
|
|
)
|
2021-11-30 12:04:28 +01:00
|
|
|
|
2022-05-08 09:55:25 +02:00
|
|
|
// Kinded represent an object with a kind.
|
2021-11-30 12:04:28 +01:00
|
|
|
type Kinded interface {
|
2022-05-08 09:55:25 +02:00
|
|
|
// Get must resturn the kind name.
|
2021-11-30 12:04:28 +01:00
|
|
|
Get() string
|
|
|
|
}
|
|
|
|
|
2022-05-08 09:55:25 +02:00
|
|
|
// Signable represents an object with a signature.
|
2021-12-01 15:17:34 +01:00
|
|
|
type Signable interface {
|
2022-05-08 09:55:25 +02:00
|
|
|
// BuildSHA must return the signature.
|
2021-12-01 15:17:34 +01:00
|
|
|
BuildSHA(filename string)
|
|
|
|
}
|
|
|
|
|
2022-05-08 09:55:25 +02:00
|
|
|
// Named represents an object with a name.
|
2021-12-02 16:07:15 +01:00
|
|
|
type Named interface {
|
2022-05-08 09:55:25 +02:00
|
|
|
// Name must return the name of the object (from metadata).
|
2021-12-02 16:07:15 +01:00
|
|
|
Name() string
|
|
|
|
}
|
|
|
|
|
2022-05-08 09:55:25 +02:00
|
|
|
// GetProjectName returns the name of the project.
|
2021-12-02 14:59:08 +01:00
|
|
|
func GetProjectName() string {
|
2021-12-01 15:17:34 +01:00
|
|
|
if len(Appname) > 0 {
|
|
|
|
return Appname
|
|
|
|
}
|
2021-11-30 12:04:28 +01:00
|
|
|
p, _ := os.Getwd()
|
|
|
|
path := strings.Split(p, string(os.PathSeparator))
|
|
|
|
return path[len(path)-1]
|
|
|
|
}
|