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 ¶
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 ¶
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 {
Description string `json:"description"`
Version string `json:"version"`
Pipelines map[string]ModulePipeline `json:"pipelines"`
}