Documentation ¶
Overview ¶
---------------------------------------------------------------------------- General utilities for handling collections ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about the configuration of Aldev ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about cancelable contexts, to help gracefully stop some processes ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about downloading external resources ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about file manipulations ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about handling HTTP requests ----------------------------------------------------------------------------
---------------------------------------------------------------------------- Downloading translations from a Google sheet into a local, structured file ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about using kubernetes ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about logging in the shell ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about running stuff in parallel ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about executing shell commands ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is about building files from templates, and Aldev config ----------------------------------------------------------------------------
---------------------------------------------------------------------------- The code here is responsible for fetching source code and copy-pasting it into our project, as configured ----------------------------------------------------------------------------
Index ¶
- Constants
- func Debug(str string, params ...any)
- func DirExists(dirPaths ...string) (string, bool)
- func DownloadExternalResources(ctx CancelableContext, cfg *AldevConfig)
- func EnsureConfigmap(cfg *AldevConfig)
- func EnsureDir(ctx CancelableContext, pathElem ...string) string
- func EnsureFileFromTemplate(cfg *AldevConfig, filepath, tpl string, params ...any)
- func Error(str string, params ...any)
- func Fatal(ctx CancelableContext, str string, params ...any)
- func FatalErr(ctx CancelableContext, err error)
- func FatalIfErr(ctx CancelableContext, err error)
- func FileExists(dirPaths ...string) (string, bool)
- func GenerateConfigs(cfg *AldevConfig)
- func InSlice[V comparable](s []V, el V) bool
- func Info(str string, params ...any)
- func InitAldevContext(waitTimeMs int, stopFn func()) *aldevContext
- func InstallGitHooks(ctx CancelableContext, cfg *AldevConfig)
- func Launch(ctx CancelableContext, cfg *AldevConfig)
- func NewBaseContext() *baseCancelableContext
- func Noop(str string, params ...any)
- func QuickRun(whyRunThis string, commandAsString string, params ...any)
- func ReadFile(ctx CancelableContext, filename string, failIfNotExist bool) []byte
- func ReadFileToJson[T any, Y *T](ctx CancelableContext, filename string, obj Y, failIfNotExist bool) Y
- func Recover(ctx CancelableContext, msg string, params ...any)
- func ReplaceInFile(ctx CancelableContext, filename string, replacements map[string]string)
- func Run(whyRunThis string, ctx CancelableContext, logStart bool, ...)
- func RunAndGet(whyRunThis string, execDir string, logStart bool, commandAsString string, ...) []byte
- func SetUseLocalDeps()
- func SetVerbose()
- func Step(str string, params ...any)
- func StepWithPreamble(preamble, str string, params ...any)
- func Warn(str string, params ...any)
- func WatcherFor(filepaths ...string) *fsnotify.Watcher
- func WriteBytesToFile(ctx CancelableContext, filename string, bytes []byte)
- func WriteJsonObjToFile(ctx CancelableContext, filename string, obj any)
- func WriteStringToFile(ctx CancelableContext, filename string, content string, params ...any)
- type AldevConfig
- type AldevContext
- type AldevTask
- type CancelableContext
- type LocalSwapsConfig
- type VendorConfig
Constants ¶
const AldevCacheDirENVVAR = "ALDEV_CACHEDIR"
const (
TagHOTSWAPPED = "___HOTSWAPPED___"
)
Variables ¶
This section is empty.
Functions ¶
func DownloadExternalResources ¶
func DownloadExternalResources(ctx CancelableContext, cfg *AldevConfig)
Downloading external resources, like translations, vendors, etc
func EnsureConfigmap ¶
func EnsureConfigmap(cfg *AldevConfig)
func EnsureDir ¶
func EnsureDir(ctx CancelableContext, pathElem ...string) string
func EnsureFileFromTemplate ¶
func EnsureFileFromTemplate(cfg *AldevConfig, filepath, tpl string, params ...any)
func Fatal ¶
func Fatal(ctx CancelableContext, str string, params ...any)
func FatalErr ¶
func FatalErr(ctx CancelableContext, err error)
func FatalIfErr ¶
func FatalIfErr(ctx CancelableContext, err error)
func FileExists ¶
func GenerateConfigs ¶
func GenerateConfigs(cfg *AldevConfig)
func InSlice ¶
func InSlice[V comparable](s []V, el V) bool
InSlice returns true if the slice s contains the given element el
func InitAldevContext ¶
func InitAldevContext(waitTimeMs int, stopFn func()) *aldevContext
func InstallGitHooks ¶
func InstallGitHooks(ctx CancelableContext, cfg *AldevConfig)
Installing Git hooks to unify our practices
func Launch ¶
func Launch(ctx CancelableContext, cfg *AldevConfig)
func NewBaseContext ¶
func NewBaseContext() *baseCancelableContext
func ReadFileToJson ¶
func ReadFileToJson[T any, Y *T](ctx CancelableContext, filename string, obj Y, failIfNotExist bool) Y
func Recover ¶
func Recover(ctx CancelableContext, msg string, params ...any)
func ReplaceInFile ¶
func ReplaceInFile(ctx CancelableContext, filename string, replacements map[string]string)
func Run ¶
func Run(whyRunThis string, ctx CancelableContext, logStart bool, commandAsString string, params ...any)
func SetUseLocalDeps ¶
func SetUseLocalDeps()
func SetVerbose ¶
func SetVerbose()
func StepWithPreamble ¶
func WatcherFor ¶
func WriteBytesToFile ¶
func WriteBytesToFile(ctx CancelableContext, filename string, bytes []byte)
func WriteJsonObjToFile ¶
func WriteJsonObjToFile(ctx CancelableContext, filename string, obj any)
func WriteStringToFile ¶
func WriteStringToFile(ctx CancelableContext, filename string, content string, params ...any)
Types ¶
type AldevConfig ¶
type AldevConfig struct { AppName string // the name of the app - beware: the key has to be "appname" in the YAML file Languages string // the languages available for this app, seperated by a comma - for example: en,fr,it,de,zh,es Lib *struct { SrcDir string // where the library source code can be found Config string // the path to the config file for the API, from the API's folder Install string // command that should be run to install stuff, like needed dependencies, etc. Develop string // command that should be run to allow for continuously developping & building the library BinDir string // the directory where to find the library's compiled binary, as seen from the library source folder (srcdir) // contains filtered or unexported fields } API *struct { SrcDir string // where the API's Goald-based code should be found Config string // the path to the config file for the API, from the API's folder Port int // the port used to expose the whole load-balanced API service I18n *struct { Link string // the link to download the translations for the current app KeySize int // the max size of the key in the translation UID route.part.key File string // the path of the file where to write the downloaded translations } DataDir string // where to find bootstraping data to run the app BinDir string // the directory where to find the API's compiled binary, as seen from the API source folder (srcdir) // contains filtered or unexported fields } APIOnly bool // if true, then no web app is handled Web *struct { SrcDir string // where the Web app's GoaldR-based code should be found Port int // the port used to expose the app's frontend EnvVars []*struct { Name string // the variable name; must start with "WEB_" Desc string // a description for the Value string // the value we're using for the local dev environment } } Vendors []*VendorConfig // external projects to vendor into our project Deploying *struct { Dir string // where all the deploying config should be } LocalSwaps []*LocalSwapsConfig // Automatically, temporarily swapping bits of code }
func ReadConfig ¶
func ReadConfig(cfgFileName string) *AldevConfig
func (*AldevConfig) GetBinDir ¶
func (thisCfg *AldevConfig) GetBinDir() string
func (*AldevConfig) GetConfigPath ¶
func (thisCfg *AldevConfig) GetConfigPath() string
func (*AldevConfig) GetResolvedBinDir ¶
func (thisCfg *AldevConfig) GetResolvedBinDir() string
func (*AldevConfig) GetSrcDir ¶
func (thisCfg *AldevConfig) GetSrcDir() string
func (*AldevConfig) IsLibrary ¶
func (thisCfg *AldevConfig) IsLibrary() bool
type AldevContext ¶
type AldevContext interface { CancelableContext GetLoopCtx() CancelableContext RestartLoop() }
an Aldev Context has a loop and allows to restart it
type AldevTask ¶
type AldevTask func(ctx CancelableContext, cfg *AldevConfig)
characterises the functions run during an aldev command or subcommand
type CancelableContext ¶
type CancelableContext interface { context.Context WithExecDir(...string) CancelableContext WithStdOutWriter(io.Writer) CancelableContext WithStdErrWriter(io.Writer) CancelableContext WithErrLogFn(errLogFn) CancelableContext CancelAll() // contains filtered or unexported methods }
type LocalSwapsConfig ¶
type LocalSwapsConfig struct { From string // the path from which to look for swaps; "." for the current project, "../../dependency" to swap in another lib For []string // the file paths for which to apply the same swaps; can be provided as a glob, e.g. "./src/**/*.ts?", Do []*struct { Replace string // the substring to look for and replace With string // the replacement EOFCom bool // should the added comment (HOTSWAPPED) be at the end of the line (// ...) rather than inline (/* ... */) ? } }