template

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Overview

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020-2023 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020-2023 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileAllProjectFiles

func CompileAllProjectFiles(env *specs.LxdCEnvironment, pName string, opts CompilerOpts) error

func CompileGroupFiles

func CompileGroupFiles(group *specs.LxdCGroup, compiler LxdCTemplateCompiler, opts CompilerOpts) error

func CompileNodeFiles

func CompileNodeFiles(node specs.LxdCNode, compiler LxdCTemplateCompiler, opts CompilerOpts) error

func CompileProjectFiles

func CompileProjectFiles(proj *specs.LxdCProject, compiler LxdCTemplateCompiler, opts CompilerOpts) error

Types

type CompilerOpts

type CompilerOpts struct {
	Sources        []string
	GroupsEnabled  []string
	GroupsDisabled []string
}

func (*CompilerOpts) IsGroupEnabled added in v0.18.1

func (o *CompilerOpts) IsGroupEnabled(g string) bool

type DefaultCompiler

type DefaultCompiler struct {
	Project    *specs.LxdCProject
	Opts       []string
	Vars       map[string]interface{}
	EnvBaseDir string
}

func (*DefaultCompiler) GetEnvBaseDir

func (r *DefaultCompiler) GetEnvBaseDir() string

func (*DefaultCompiler) GetVars

func (r *DefaultCompiler) GetVars() *map[string]interface{}

func (*DefaultCompiler) InitVars

func (r *DefaultCompiler) InitVars()

func (*DefaultCompiler) SetEnvBaseDir

func (r *DefaultCompiler) SetEnvBaseDir(dir string)

func (*DefaultCompiler) SetOpts

func (r *DefaultCompiler) SetOpts(o []string)

type Jinja2Compiler

type Jinja2Compiler struct {
	*DefaultCompiler
}

func NewJinja2Compiler

func NewJinja2Compiler(proj *specs.LxdCProject) *Jinja2Compiler

func (*Jinja2Compiler) Compile

func (r *Jinja2Compiler) Compile(sourceFile, destFile string) error

func (*Jinja2Compiler) CompileRaw

func (r *Jinja2Compiler) CompileRaw(sourceData string) (string, error)

type LxdCTemplateCompiler

type LxdCTemplateCompiler interface {
	InitVars()
	SetOpts([]string)
	Compile(sourceFile, destFile string) error
	CompileRaw(sourceContent string) (string, error)
	GetEnvBaseDir() string
	SetEnvBaseDir(string)
	GetVars() *map[string]interface{}
}

func NewProjectTemplateCompiler

func NewProjectTemplateCompiler(env *specs.LxdCEnvironment, proj *specs.LxdCProject) (LxdCTemplateCompiler, error)

type MottainaiCompiler

type MottainaiCompiler struct {
	*DefaultCompiler
}

func NewMottainaiCompiler

func NewMottainaiCompiler(proj *specs.LxdCProject) *MottainaiCompiler

func (*MottainaiCompiler) Compile

func (r *MottainaiCompiler) Compile(sourceFile, destFile string) error

func (*MottainaiCompiler) CompileRaw

func (r *MottainaiCompiler) CompileRaw(sourceData string) (string, error)

type Template added in v0.14.3

type Template struct {
	Values map[string]interface{}
}

func NewTemplate added in v0.14.3

func NewTemplate() *Template

func (*Template) AppendValue added in v0.14.3

func (tem *Template) AppendValue(k string, v interface{})

func (*Template) Draw added in v0.14.3

func (tem *Template) Draw(raw string) (string, error)

func (*Template) DrawFromFile added in v0.14.3

func (tem *Template) DrawFromFile(file string) (string, error)

func (*Template) LoadValues added in v0.14.3

func (tem *Template) LoadValues(raw string) error

func (*Template) LoadValuesFromFile added in v0.14.3

func (tem *Template) LoadValuesFromFile(file string) error

func (*Template) ReadValues added in v0.14.3

func (tem *Template) ReadValues(raw string) (map[string]map[string]interface{}, error)

Jump to

Keyboard shortcuts

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