Documentation
¶
Index ¶
- Constants
- func CleanOutputDirectory(outputDir string) error
- func CopyFolder(src, dest string) error
- func CreateMarkerFile(outputDir string, sourceVersion string, sourcePath string, sourceHash string, ...) error
- func DirectoryExists(dir string) (bool, error)
- func FileExists(file string) (bool, error)
- func GetGeneratorSchemaVersion(markerPath string) (string, error)
- func HashPath(path string, ignoreNames []string) (string, error)
- func PathExists(path string) (isDir bool, isFile bool, err error)
- func UnzipFile(zipFilePath string, targetDir string, extractPath string) error
- func VerifyGeneratorSource(templatesPath string, helpersPath string, defaultValuesPath string, ...) error
- func WriteRuntimeTemplates(runtimeTemplatePath string, inputDirConfig string, outputDirConfig string) error
- type GeneratorMarker
- type RunInfo
- type SourceHelper
- type SourceHelperOptions
Constants ¶
const ( InputDirTemplateFile = "input_dir" OutputDirTemplateFile = "output_dir" )
const ( // DeployKFOutputMarker is the name of the marker file that is created by deployKF in output directories, // the presence of this file indicates that the directory is safe to clean. DeployKFOutputMarker = ".deploykf_output" )
Variables ¶
This section is empty.
Functions ¶
func CleanOutputDirectory ¶
CleanOutputDirectory cleans the output directory if it's safe to do so.
func CopyFolder ¶
CopyFolder recursively copies the contents of the source folder to the destination folder
func CreateMarkerFile ¶
func CreateMarkerFile(outputDir string, sourceVersion string, sourcePath string, sourceHash string, cliVersion string) error
CreateMarkerFile creates a marker file with RunInfo JSON in the output directory.
func DirectoryExists ¶
func FileExists ¶
func GetGeneratorSchemaVersion ¶
GetGeneratorSchemaVersion returns the `generator_schema` version from the specified marker file.
func HashPath ¶
HashPath takes a path as input and returns the SHA-256 hash of the path. If the path is a file, it computes the hash of the file. If the path is a folder, it computes the hash of all files within the folder. It accepts an additional argument 'ignoreNames' which is a slice of file names to ignore.
func UnzipFile ¶
UnzipFile extracts the contents of a .zip file to a destination directory extractPath is the relative path inside the zip archive that should be extracted If extractPath does not match any files or directories in the zip archive, an error is returned
func VerifyGeneratorSource ¶
func VerifyGeneratorSource(templatesPath string, helpersPath string, defaultValuesPath string, markerPath string) error
VerifyGeneratorSource verifies that the specified paths make a valid generator source, and that this version of the CLI supports the generator schema version.
Types ¶
type GeneratorMarker ¶
type GeneratorMarker struct {
GeneratorSchema string `json:"generator_schema"`
}
type SourceHelper ¶
type SourceHelper struct {
GithubOwner string // the owner of the generator source GitHub repository
GithubRepo string // the name of the generator source GitHub repository
GeneratorArtifactPrefix string // the file-prefix of the generator source zip artifact
GeneratorArtifactSuffix string // the file-suffix of the generator source zip artifact
AssetsCacheDir string // the sub-path under `os.UserHomeDir()` where zip artifacts will be cached
}
func NewSourceHelper ¶
func NewSourceHelper(opts ...SourceHelperOptions) *SourceHelper
func (*SourceHelper) DownloadAndUnpackSource ¶
func (h *SourceHelper) DownloadAndUnpackSource(version string, unpackTargetDir string, out io.Writer) (string, error)
DownloadAndUnpackSource downloads the generator source artifact for the specified version (if it's not already cached), unpacks it to the provided folder, then returns the local path of the artifact .zip file.
type SourceHelperOptions ¶
type SourceHelperOptions func(*SourceHelper)
func WithGithubOwner ¶
func WithGithubOwner(owner string) SourceHelperOptions
func WithGithubRepo ¶
func WithGithubRepo(repo string) SourceHelperOptions