profile

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RehashAllProfiles added in v1.1.0

func RehashAllProfiles(ctx context.Context) error

func RehashSingle

func RehashSingle(ctx context.Context, profileName string) error

Types

type Configurable

type Configurable interface {
	Config() interface{}
	ConfigFile(profileLocation string) string
	LoadConfig(profileLocation string) error
}

Configurable interface allow a plugin to load configuration from the profile folder

type Generator

type Generator interface {
	Generate(profileLocation string) error
}

Generator interface allow a plugin to generate content before rendering

type Pluggable

type Pluggable interface {
	Name() string
	Renderable
}

Pluggable interface allow a plugin to be "plugged" in a profile. Is the common interface implemented by all plugins

type Profile

type Profile struct {
	// Name of the profile
	Name string
	// Location of the profile
	Location string
	// Plugins contains a map of Pluggable
	Plugins map[string]Pluggable
	// Shell is the shell to be used by profile
	Shell string

	// Config contains profile specific configurations
	Config ProfileConfig

	// RunLoaderPath is the path to be used for the profile run script
	RunLoaderPath string
	// ShellLoaderPath is the path to be used for the profile load script
	ShellLoaderPath string
}

Profile holds information for a single profile

func New

func New(ctx context.Context, name string) (p *Profile, err error)

New creates a new Profile instance with appropriate configurations

func (Profile) Exists

func (p Profile) Exists() bool

Exists return where the profile exists Profile existance is determinated by profile Location existance

func (Profile) GenerateShellLoadFile

func (p Profile) GenerateShellLoadFile(ctx context.Context) error

GenerateShellLoadFile generate profile shell loader file

func (*Profile) LoadConfig

func (p *Profile) LoadConfig() error

func (*Profile) LoadPluginConfigurations

func (p *Profile) LoadPluginConfigurations(ctx context.Context) error

LoadPluginConfigurations load each Configurable plugin configuration

func (Profile) LoadPlugins

func (p Profile) LoadPlugins()

LoadPlugins load profile plugins

func (*Profile) RunPluginGeneration

func (p *Profile) RunPluginGeneration(ctx context.Context) error

RunPluginGeneration run each Generator plugin generation

func (Profile) SetupPlugins

func (p Profile) SetupPlugins(ctx context.Context) error

SetupPlugins run Setuppable plugins Setup

type ProfileConfig

type ProfileConfig struct {
	Plugins []string
}

func (*ProfileConfig) LoadFromFile

func (pc *ProfileConfig) LoadFromFile(path string) error

type Renderable

type Renderable interface {
	Render(profileName, profileLocation string) string
}

Renderable interface allow a plugin to render content in the shell loader and runner files

type Setuppable

type Setuppable interface {
	Setup(profileLocation string) error
}

Setuppable interface allow a plugin to perform setup steps before rendering

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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