launchr

package module
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 14 Imported by: 26

README

Launchr

Launchr is a CLI action runner that executes actions inside short-lived local containers.
Actions are defined in action.yaml files, which are automatically discovered in the filesystem. They can be placed anywhere that makes sense semantically. You can find action examples here and in the documentation.
Launchr has a plugin system that allows to extend its functionality. See core plugins, compose and documentation.

Table of contents

Usage

Build launchr from source locally. Build dependencies:

  1. go >=1.20, see installation guide
  2. make

Build the launchr tool:

make
bin/launchr --help

The documentation for launchr usage can be found in docs.

If you face any issues with launchr:

  1. Open an issue in the repo.
  2. Share the app version with launchr --version

Installation

Installation from source

Build dependencies:

  1. go >=1.20, see installation guide
  2. make

Global installation

Install launchr globally:

make install
launchr --version

The tool will be installed in $GOPATH/bin which is usually ~/go/bin.
If GOPATH env variable is not available, make sure you have it in ~/.bashrc or ~/.zhrc:

export GOPATH=`go env GOPATH`
export PATH=$PATH:$GOPATH/bin

Local installation

The tool can be built and run locally:

make
bin/launchr --version

Development

The launchr can be built with a make to bin directory:

make

It is also supported to make a build to use with dlv for debug:

make DEBUG=1

Useful make commands:

  1. Fetch dependencies - make deps
  2. Test the code - make test
  3. Lint the code - make lint

Documentation

Overview

Package launchr has application implementation.

Index

Constants

This section is empty.

Variables

View Source
var (
	// GetFsAbsPath returns absolute path for an FS struct.
	GetFsAbsPath = launchr.GetFsAbsPath
	// EnsurePath creates all directories in the path.
	EnsurePath = launchr.EnsurePath
)

Reexport for usage by other modules.

View Source
var (
	Name          = "launchr" // Name - version info
	Version       = "dev"     // Version - version info
	CustomVersion string      // CustomVersion - custom version text
)
View Source
var ActionsGroup = &cobra.Group{
	ID:    "actions",
	Title: "Actions:",
}

ActionsGroup is a cobra command group definition

Functions

func Gen

func Gen() int

Gen generates application specific build files and returns os exit code.

func GetPluginByType added in v0.0.8

func GetPluginByType[T Plugin](app *App) []T

GetPluginByType returns specific plugins from the app.

func GetService added in v0.0.8

func GetService[T Service](app *App) T

GetService returns a service from the app. It uses generics to find the exact service.

func RegisterPlugin

func RegisterPlugin(p Plugin)

RegisterPlugin add a plugin to global pull.

func Run

func Run() int

Run executes launchr application.

func SetCustomVersion

func SetCustomVersion(v string)

SetCustomVersion stores custom version string for output, for example on custom build.

func ToCamelCase

func ToCamelCase(s string, capFirst bool) string

ToCamelCase converts a string to CamelCase

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App holds app related global variables.

func NewApp

func NewApp() *App

NewApp constructs app implementation.

func (*App) AddService added in v0.0.9

func (app *App) AddService(s Service)

AddService registers a service in the app.

func (*App) Execute

func (app *App) Execute() int

Execute is a cobra entrypoint to the launchr app.

func (*App) Generate

func (app *App) Generate() int

Generate runs generation of included plugins.

func (*App) GetWD added in v0.0.2

func (app *App) GetWD() string

GetWD provides app's working dir.

func (*App) Streams added in v0.0.9

func (app *App) Streams() cli.Streams

Streams returns application cli.

type AppVersion

type AppVersion struct {
	Name          string
	Version       string
	OS            string
	Arch          string
	CustomVersion string
}

AppVersion stores application version.

func GetVersion

func GetVersion() *AppVersion

GetVersion provides app version info.

func (*AppVersion) String

func (v *AppVersion) String() string

type CobraPlugin

type CobraPlugin interface {
	Plugin
	// CobraAddCommands is a hook called when cobra root command is available.
	// Plugins may register its command line commands here.
	CobraAddCommands(*cobra.Command) error
}

CobraPlugin is an interface to implement a plugin for cobra.

type GeneratePlugin

type GeneratePlugin interface {
	Plugin
	// Generate is a function called when application is generating code and assets for the build.
	Generate(buildPath string, workDir string) (*PluginGeneratedData, error)
}

GeneratePlugin is an interface to generate supporting files before build.

type GlobalConfig added in v0.0.9

type GlobalConfig = config.GlobalConfig

GlobalConfig handles global configuration.

type GlobalConfigAware added in v0.0.9

type GlobalConfigAware = config.GlobalConfigAware

GlobalConfigAware provides an interface for structs to support global configuration setting.

type Plugin

type Plugin interface {
	// PluginInfo requests a type to provide information about the plugin.
	// The Plugin info is used as a unique data to indentify a plugin.
	PluginInfo() PluginInfo
	// InitApp is hook function called on application initialisation.
	// Plugins may save app global object, retrieve or provide services here.
	InitApp(app *App) error
}

Plugin is a common interface for launchr plugins.

type PluginGeneratedData

type PluginGeneratedData struct {
	Plugins []string
}

PluginGeneratedData is a struct containing a result information of plugin generation.

type PluginInfo

type PluginInfo struct {
	ID string
}

PluginInfo provides information about the plugin and is used as a unique data to indentify a plugin.

type PluginManager added in v0.0.8

type PluginManager interface {
	Service
	All() map[PluginInfo]Plugin
}

PluginManager handles plugins.

type Service added in v0.0.8

type Service = launchr.Service

Service is a common interface for a service to register.

type ServiceInfo added in v0.0.8

type ServiceInfo = launchr.ServiceInfo

ServiceInfo provides service info for its initialization.

Directories

Path Synopsis
cmd
launchr command
Package executes Launchr application.
Package executes Launchr application.
launchr/gen
Package gen is here to provide example structure for the built app.
Package gen is here to provide example structure for the built app.
internal
launchr
Package launchr provides common app functionality.
Package launchr provides common app functionality.
launchr/config
Package config provides global app config object.
Package config provides global app config object.
pkg
action
Package action provides implementations of discovering and running actions.
Package action provides implementations of discovering and running actions.
cli
Package cli implements printing functionality for CLI output.
Package cli implements printing functionality for CLI output.
driver
Package driver hold implementation for action drivers.
Package driver hold implementation for action drivers.
driver/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
jsonschema
Package jsonschema has functionality related to json schema support.
Package jsonschema has functionality related to json schema support.
log
Package log is meant to provide a global logger for the application and provide logging functionality interface.
Package log is meant to provide a global logger for the application and provide logging functionality interface.
plugins
Package plugins provides launchr core plugins.
Package plugins provides launchr core plugins.
plugins/builder
Package builder implements launchr functionality to build itself.
Package builder implements launchr functionality to build itself.
plugins/verbosity
Package verbosity is a plugin of launchr to configure log level of the app.
Package verbosity is a plugin of launchr to configure log level of the app.
plugins/yamldiscovery
Package yamldiscovery implements a launchr plugin to discover actions defined in yaml.
Package yamldiscovery implements a launchr plugin to discover actions defined in yaml.
plugins/yamldiscovery/embed
Package embed provides yaml discovery with embed actions definition.
Package embed provides yaml discovery with embed actions definition.
types
Package types contains launchr common types.
Package types contains launchr common types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL