Documentation ¶
Index ¶
Constants ¶
const DevelopmentMode = 0
DevelopmentMode represents a config en set to DevelopementMode
const ProductionMode = 1
ProductionMode repesents a config env set to production
Variables ¶
var DefaultBuilder = BuildConfig{ Addr: ":8000", Env: "dev", Bin: "./bin", Main: "./main.go", DoGoGet: "true", UseMain: "false", Client: JSConfig{ StaticDir: "./static/js", Name: "client", Verbose: "false", }, Static: StaticConfig{ Dir: "./static", }, }
DefaultBuilder provides a default config for builders
var RootCmd = &cobra.Command{
Use: "relay",
Short: "relay provides a cli for relay projects",
}
RootCmd provides the core command for the cli
Functions ¶
func RegisterDefaultPlugins ¶
func RegisterDefaultPlugins(pm *PluginManager)
RegisterDefaultPlugins provides a set of default plugins for relay
Types ¶
type BuildConfig ¶
type BuildConfig struct { Name string `yaml:"name"` Addr string `yaml:"addr"` Env string `yaml:"env"` Bin string `yaml:"bin"` Main string `yaml:"main"` Package string `yaml:"package"` BinArgs []string `yaml:"bin_args"` Client JSConfig `yaml:"client"` Static StaticConfig `yaml:"static"` Plugins map[string]Plugins `yaml:"plugins"` Mode int `yaml:"-"` ClientPackage string `yaml:"-"` Goget bool `yaml:"-"` GoMain bool `yaml:"-"` BuildPlugin *PluginManager `yaml:"-"` //Commands will be executed before any building of assets or compiling of binary Commands []string `yaml:"commands"` //dogoget ensures that after the first initial building that go get gets re-run on each rebuild DoGoGet string `yaml:"dogoget"` //useMain ensures to instead run the main file giving in 'main' instead of the built binary to reduce time UseMain string `yaml:"usemain"` }
BuildConfig provides the configuration details for the building constraints for using relay's builder
func NewBuildConfig ¶
func NewBuildConfig() *BuildConfig
NewBuildConfig returns a new BuildConfig based off the defaults
func (*BuildConfig) Load ¶
func (c *BuildConfig) Load(file string) error
Load loads the configuration from a yaml file
type JSConfig ¶
type JSConfig struct { Dir string `yaml:"dir"` Exclude []string `yaml:"exclude"` Extensions []string `yaml:"exts"` //BuildTags to be used in building the js files BuildTags []string `yaml:"tags"` //Name defines the name to call the file and its map i.e 'appa' makes js file to be appa.js and appa.js.map respectively Name string `yaml:"name"` // StaticDir defines the location in the static directory the compiled version will also be stored for cases when you decide to not use the virtual fs StaticDir string `yaml:"static_dir"` //Verbose sets the verbosity of the build process Verbose string `yaml:"verbose"` UseVerbose bool `yaml:"-"` }
JSConfig provides the configuration details for the gopherjs project location and arguments
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager provides a basic plugin management system for the cli
func NewPluginManager ¶
func NewPluginManager() *PluginManager
NewPluginManager returns a new plugin manager
func (*PluginManager) Activate ¶
func (pm *PluginManager) Activate(m Plugins, b *BuildConfig, c chan bool)
Activate activates a specific plugin
func (*PluginManager) Add ¶
func (pm *PluginManager) Add(name string, fx PluginMux)
Add adds a new plugin to the list
type PluginMux ¶
type PluginMux func(*BuildConfig, Plugins, chan bool)
PluginMux defines a function type for a plugin activator
type Plugins ¶
type Plugins struct { Tag string `yaml:"tag"` Args []string `yaml:"args"` Config PluginConfig `yaml:"config"` }
Plugins represent a map of pluginConfigs
type StaticConfig ¶
type StaticConfig struct { Dir string `yaml:"dir"` StripPrefix string `yaml:"strip_prefix"` Exclude string `yaml:"exclude"` }
StaticConfig provides the configuration details for the static files location and arguments