config

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrFailedOpen is when the template failed building
	ErrFailedOpen = errors.NewError("could not open the config file", 1)
	//ErrFailedParse is for a failure moving the static folder
	ErrFailedParse = errors.NewError("could not parse the config file", 2)
	//ErrFailedWrite is for a failure in gathering files.
	ErrFailedWrite = errors.NewError("could not write the config file", 3)
	//ErrNoTemplateFolder is for a failure in gathering files.
	ErrNoTemplateFolder = errors.NewError("template folder not set", 4)
	//ErrNoOutputFolder is for a failure in gathering files.
	ErrNoOutputFolder = errors.NewError("output folder not set", 5)
	//ErrFailedCreateLog is for a failure in gathering files.
	ErrFailedCreateLog = errors.NewError("could not open log file", 6)

	//ErrDependencyWrongFormat means a wrong format for a dependency
	ErrDependencyWrongFormat = errors.NewError("dependency must be in the format 'json' or 'json@1.0.0'", 101)
)

Functions

func LoadDefaultGlobal added in v0.13.0

func LoadDefaultGlobal() error

LoadDefaultGlobal config file

func SaveConfig

func SaveConfig(configLocation string, cfg *Config) errors.Error

SaveConfig saves the config file

func SaveDefaultGlobal added in v0.13.0

func SaveDefaultGlobal() error

SaveDefaultGlobal config file

Types

type Config

type Config struct {
	LogConfig  log                         `json:"logging"`
	Folders    Folder                      `json:"folders"`
	Modules    Modules                     `json:"modules"`
	Pages      *site.ConfigSite            `json:"pages"`
	ModuleHost map[string]*host.ModuleHost `json:"-"`
	UILogger   UIlogger                    `json:"-"`
}

Config is the config struct

func CleanConfig added in v0.7.0

func CleanConfig(configLocation string, ui uiLoggerSetter, useLog bool) (*Config, errors.Error)

CleanConfig does everything for you

func GetConfig

func GetConfig(configLocation string) (cfg *Config, reterr errors.Error)

GetConfig gets the config file. DOES NOT CHECK FOR MISSING INFORMATION!!

func ParseConfig added in v0.7.0

func ParseConfig(configLocation string) (*Config, errors.Error)

ParseConfig parses the config file and check for any missing information

type Folder

type Folder struct {
	Templates string `json:"templates"`
	Static    string `json:"static"`
	Output    string `json:"output"`
	Modules   string `json:"modules"`
}

Folder is the part of the config file that handles folders

type GlobalConfig added in v0.13.0

type GlobalConfig struct {
	Repositories []string `json:"repositories"`
}

GlobalConfig is a global antibuild configuration

var DefaultGlobalConfig *GlobalConfig

DefaultGlobalConfig that gets auto opened

func OpenGlobalConfig added in v0.13.0

func OpenGlobalConfig(path string) (*GlobalConfig, error)

OpenGlobalConfig opens and parses a global config file

func (*GlobalConfig) Save added in v0.13.0

func (c *GlobalConfig) Save(path string) error

Save the global config

type Logger added in v0.6.0

type Logger interface {
	Info(string)
	Infof(string, ...interface{})
	Error(string)
	Errorf(string, ...interface{})
	Fatal(string)
	Fatalf(string, ...interface{})
	Debug(string)
	Debugf(string, ...interface{})
	ShouldEnableDebug(bool)
}

Logger is the logger we use

type Module added in v0.13.0

type Module struct {
	Repository string
	Version    string
}

Module with info about the path and version

func ParseModuleString added in v0.13.0

func ParseModuleString(moduleString string) (m *Module, err errors.Error)

ParseModuleString for config and cli

func (*Module) MarshalJSON added in v0.13.0

func (m *Module) MarshalJSON() ([]byte, error)

MarshalJSON on a module

func (*Module) UnmarshalJSON added in v0.13.0

func (m *Module) UnmarshalJSON(data []byte) error

UnmarshalJSON on a module

type Modules

type Modules struct {
	Dependencies map[string]*Module                `json:"dependencies"`
	Config       map[string]map[string]interface{} `json:"config,omitempty"`
	SPPs         []string                          `json:"spps,omitempty"`
}

Modules is the part of the config file that handles modules

type UIlogger added in v0.6.1

type UIlogger interface {
	Logger
	// contains filtered or unexported methods
}

UIlogger combines a UI and a logger

Jump to

Keyboard shortcuts

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