Documentation
¶
Index ¶
- func FinaliseModules(ctx context.Context, pathToRepo string, opts ...AppOptions)
- func FormatGoFiles(ctx context.Context, pathToRepo string)
- func GenerateProject(appName, appDesc, projType, projectLocation, goVer, port string, ...) error
- func GetTemplatePath() string
- func InitGoModules(ctx context.Context, pathToRepo, name string) error
- func IsEmptyDir(path string) (isEmptyDir bool, err error)
- func OfferPurgeProjectDestination(ctx context.Context, projectPath string) error
- func OptionPromptInput(ctx context.Context, prompt string, options ...string) (string, error)
- func PromptForConfirmation(ctx context.Context, prompt string, maxInputAttempts int) bool
- func PromptForInput(ctx context.Context, prompt string) (string, error)
- func SetTemplatePath(path string)
- func ValidVersionNumber(ver string) bool
- func ValidateAppDescription(ctx context.Context, description string) (string, error)
- func ValidateAppName(ctx context.Context, name string) (string, error)
- func ValidateArguments(arguments map[string]*Argument) (map[string]*Argument, error)
- func ValidateBranchingStrategy(ctx context.Context, branchingStrategy string) (string, error)
- func ValidateGoVersion(ctx context.Context, goVer string) (string, error)
- func ValidatePortNumber(ctx context.Context, port string) (validatedPort string, err error)
- func ValidateProjectDirectory(ctx context.Context, path, projectName string) error
- func ValidateProjectLocation(ctx context.Context, projectLocation string) (string, error)
- func ValidateProjectType(ctx context.Context, projectType string) (validatedProjectType string, err error)
- func ValidateTeamSlugs(ctx context.Context, teamSlugs string) (string, error)
- type AppOptions
- type Argument
- type ListOfArguments
- type ProjectType
- type TemplateModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FinaliseModules ¶
func FinaliseModules(ctx context.Context, pathToRepo string, opts ...AppOptions)
FinaliseModules will run go build ./... to generate go modules dependency management files
func FormatGoFiles ¶
FormatGoFiles will run go fmt ./... to ensure all generated code conforms to standards
func GenerateProject ¶
func GenerateProject(appName, appDesc, projType, projectLocation, goVer, port string, teamSlugs string, repositoryCreated bool) error
GenerateProject is the entry point into generating a project
func GetTemplatePath ¶
func GetTemplatePath() string
func InitGoModules ¶
InitGoModules will initialise the go modules for a project at a given directory unless go.mod already exists
func IsEmptyDir ¶
IsEmptyDir will check if a given directory is empty or not
func OfferPurgeProjectDestination ¶
OfferPurgeProjectDestination will offer the user an option to purge the contents at a given location
func OptionPromptInput ¶
func PromptForConfirmation ¶
PromptForConfirmation will prompt for yes/no style answers on command-line
func PromptForInput ¶
PromptForInput will write a line to output then wait for input which is returned from the function
func SetTemplatePath ¶
func SetTemplatePath(path string)
func ValidVersionNumber ¶
func ValidateAppDescription ¶
ValidateAppDescription will ensure that the app description has been provided and is acceptable, if not it will keep prompting until it is
func ValidateAppName ¶
ValidateAppName will ensure that the app name has been provided and is acceptable, if not it will keep prompting until it is
func ValidateArguments ¶
func ValidateBranchingStrategy ¶
ValidateBranchingStrategy will ensure that the strategy provided by the user is one that can be boilerplate
func ValidateGoVersion ¶
ValidateGoVersion will ensure that the golang docker hub image version provided by the user is valid
func ValidatePortNumber ¶
func ValidateProjectLocation ¶
ValidateProjectLocation will ensure that the projects location has been provided and is acceptable. It will ensure the directory exists and has the option to offer a purge of files at that location
Types ¶
type AppOptions ¶
type AppOptions struct {
Type ProjectType
}
type ListOfArguments ¶
type ProjectType ¶
type ProjectType string
const ( GenericProject ProjectType = "generic-project" BaseApplication ProjectType = "base-application" API ProjectType = "api" Controller ProjectType = "controller" EventDriven ProjectType = "event-driven" Library ProjectType = "library" )
type TemplateModel ¶
type TemplateModel struct {
Name string
Description string
Year int
GoVersion string
DebianCodename string
Port string
TeamSlugs []string
}
func PopulateTemplateModel ¶
func PopulateTemplateModel(name, desc, goVer, debCN, port string, teamSlugs []string) TemplateModel
PopulateTemplateModel will populate the templating model with variables that can be used in templates