template

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

ABOUTME: Configuration file loader for .bingo.yaml metadata ABOUTME: Reads service mappings from bingo project template

ABOUTME: Template fetcher for downloading and caching bingo project from GitHub ABOUTME: Handles tarball download, extraction, and local caching with file locking

ABOUTME: Package name and directory name replacer for template processing ABOUTME: Handles module name substitution and directory renaming

ABOUTME: Template version management for GitHub-based template fetching ABOUTME: Defines default version and ref validation logic

Index

Constants

View Source
const BingoAppName = "bingo"

BingoAppName is the default app name used in bingo template

View Source
const BingoRootPackage = "github.com/bingo-project/bingo"

BingoRootPackage is the root package of the bingo template This should match the module name in bingo's go.mod

View Source
const DefaultTemplateVersion = "main"

DefaultTemplateVersion is the recommended template version

Variables

This section is empty.

Functions

This section is empty.

Types

type BingoConfig added in v1.5.6

type BingoConfig struct {
	Version  int                    `yaml:"version"`
	Services map[string]ServiceInfo `yaml:"services"`
}

BingoConfig represents .bingo.yaml configuration file structure

func LoadBingoConfig added in v1.5.6

func LoadBingoConfig(path string) (*BingoConfig, error)

LoadBingoConfig loads and parses .bingo.yaml

type Fetcher

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

Fetcher handles template downloading and caching

func NewFetcher

func NewFetcher() (*Fetcher, error)

NewFetcher creates a new Fetcher instance

func (*Fetcher) FetchTemplate

func (f *Fetcher) FetchTemplate(ref string, noCache bool) (string, error)

FetchTemplate downloads template to cache (if not exists), returns cache path Execution steps: 1. Check cache directory exists, create if not (permission 0755) 2. Check cache directory is writable, return friendly error if not 3. Check cache hit (unless noCache=true) 4. If need to download, acquire file lock, download and extract to cache 5. Return cache path

type Replacer

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

Replacer handles module name and directory name replacement

func NewReplacer

func NewReplacer(targetDir, oldModule, newModule, appName string) *Replacer

NewReplacer creates a new Replacer instance

func (*Replacer) RenameConfigFiles added in v1.6.1

func (r *Replacer) RenameConfigFiles() error

RenameConfigFiles renames config files according to explicit rules Only renames files that exist (some may be filtered out with services)

func (*Replacer) RenameDirs

func (r *Replacer) RenameDirs() error

RenameDirs renames directories according to explicit rules Only renames directories that still exist (after service filtering)

func (*Replacer) ReplaceAppName added in v1.6.1

func (r *Replacer) ReplaceAppName() error

ReplaceAppName replaces app name references in files Should be called after ReplaceModuleName to avoid conflicts with module paths

func (*Replacer) ReplaceBingoConfig added in v1.6.2

func (r *Replacer) ReplaceBingoConfig() error

ReplaceBingoConfig replaces values in .bingo.example.yaml Replaces rootPackage and database fields with the new module/app name

func (*Replacer) ReplaceModuleName

func (r *Replacer) ReplaceModuleName() error

ReplaceModuleName replaces all files with module name Traverses target directory, replaces based on file extension

type ServiceInfo

type ServiceInfo struct {
	Cmd         string `yaml:"cmd"`
	Internal    string `yaml:"internal"`
	Description string `yaml:"description"`
}

ServiceInfo describes a service's directory structure

Jump to

Keyboard shortcuts

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