domain

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// Config holds the configuration paths for the project and templates.
	Config *Config

	// Data holds the parsed structure and templates data.
	Data *BuilderData

	// ParsedData holds the parsed file content.
	ParsedData string

	// Fs is the file system service used to interact with the file system.
	Fs filesystem.FileSystemInterface
}

Builder is responsible for managing the configuration and data required to build the project structure.

func NewBuilder

func NewBuilder(fs filesystem.FileSystemInterface, config *Config) (*Builder, error)

NewBuilder initializes a new Builder instance.

Parameters:

  • file: The path to the configuration file (JSON or YAML).
  • vars: A map of variables to replace placeholders in the configuration file.
  • config: A pointer to the Config struct containing project and templates paths.

Returns:

A pointer to a Builder instance if successful, or an error if initialization fails.

func (*Builder) SetBuilderDataFromFile

func (b *Builder) SetBuilderDataFromFile(file string, vars map[string]interface{}) error

SetBuilderDataFromFile parses the configuration file and populates the BuilderData.

Parameters:

  • file: The path to the configuration file.
  • vars: A map of variables for placeholder replacement in the configuration.

Returns:

An error if parsing fails, otherwise nil.

type BuilderData

type BuilderData struct {
	// Structure defines the directory and file hierarchy to be created.
	Structure map[string]interface{}

	// Templates defines the templates to be applied to the generated files.
	Templates map[string]interface{}

	// Global defines the global variables to be used in all the templates.
	Global map[string]interface{}
}

BuilderData encapsulates the structure and templates data parsed from configuration files.

type Config

type Config struct {
	// ProjectPath specifies the root directory where the project will be generated.
	ProjectPath string

	// TemplatesPath specifies the directory where template files are located.
	TemplatesPath string
}

Config holds the configuration paths required for the application. It includes paths for the project directory and the templates directory.

func NewConfig

func NewConfig(projectPath string, templatesPath string) *Config

NewConfig creates and returns a new Config instance with the provided project and templates paths.

Parameters:

  • projectPath: The file system path to the project directory.
  • templatesPath: The file system path to the templates directory.

Returns:

A pointer to a Config struct initialized with the given paths.

type Module

type Module struct {
	Key         string                    `json:"key"`
	Description string                    `json:"description"`
	Version     string                    `json:"version"`
	Pipelines   map[string]ModulePipeline `json:"pipelines"`
}

func NewModule

func NewModule(moduleKey string, module map[string]interface{}, pipelines map[string]Pipeline) Module

type ModulePipeline added in v1.1.0

type ModulePipeline struct {
	Description string `json:"description"`
	File        string `json:"file"`
}

type Pipeline added in v1.1.0

type Pipeline struct {
	Key         string        `json:"key"`
	Description string        `json:"description"`
	Steps       []interface{} `json:"steps"`
	File        string        `json:"file"`
	Visible     bool          `json:"visible"`
}

func NewPipeline added in v1.1.0

func NewPipeline(key string, description string, steps []interface{}, file string, visible bool) Pipeline

type Template

type Template struct {
	Name        string
	Tags        []string
	Description string
}

func NewTemplate

func NewTemplate(name, description string, tags []string) Template

Jump to

Keyboard shortcuts

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