- .github
- actions
- api
- blueprints
-
cmd
-
timoni
- testdata
- apply.go
- apply_test.go
- artifact.go
- artifact_list.go
- artifact_pull.go
- artifact_pull_test.go
- artifact_push.go
- artifact_push_test.go
- artifact_tag.go
- artifact_tag_test.go
- build.go
- build_test.go
- bundle.go
- bundle_apply.go
- bundle_apply_test.go
- bundle_build.go
- bundle_build_test.go
- bundle_delete.go
- bundle_delete_test.go
- bundle_status.go
- bundle_status_test.go
- bundle_vet.go
- bundle_vet_test.go
- completion.go
- completion_bash.go
- completion_fish.go
- completion_funcs.go
- completion_powershell.go
- completion_zsh.go
- delete.go
- delete_test.go
- docgen.go
- dyff.go
- dyff_test.go
- errors.go
- inspect.go
- inspect_module.go
- inspect_resources.go
- inspect_test.go
- inspect_values.go
- list.go
- log.go
- main.go
- main_test.go
- mod.go
- mod_init.go
- mod_list.go
- mod_list_test.go
- mod_pull.go
- mod_pull_test.go
- mod_push.go
- mod_push_test.go
- mod_show.go
- mod_show_config.go
- mod_show_config_test.go
- mod_vendor.go
- mod_vendor_crd.go
- mod_vendor_crd_test.go
- mod_vendor_k8s.go
- mod_vet.go
- mod_vet_test.go
- registry.go
- runtime.go
- runtime_build.go
- runtime_build_test.go
- status.go
- status_test.go
- version.go
- version_test.go
-
timoni
- docs
-
examples
- bundles
-
minimal
- cue.mod
- templates
- README.md
- debug_tool.cue
- debug_values.cue
- timoni.cue
- values.cue
- redis
- hack
-
internal
-
engine
- fetcher
- testdata
- bundle_builder.go
- bundle_builder_test.go
- doc.go
- importer.go
- importer_test.go
- module_builder.go
- module_builder_test.go
- resourceset.go
- resourceset_test.go
- runtime_builder.go
- runtime_builder_test.go
- runtime_injector.go
- runtime_injector_test.go
- utils.go
- utils_test.go
- values_builder.go
- values_builder_test.go
- flags
- oci
- runtime
- testutils
-
engine
- logo
- schemas
- .gitattributes
- .gitignore
- .goreleaser.yml
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- DCO
- LICENSE
- Makefile
- README.md
- SECURITY.md
- go.mod
- go.sum
- mkdocs.yml
- proto-plugin.toml
Explanation
The code you provided defines a Local
struct and implements the Fetcher
interface for retrieving local Timoni modules.
Local
Struct:
src
: The source path of the local module, trimmed of the “file://” prefix.dst
: The destination path where the module will be copied.requiredFiles
: A list of required files within the module directory (cue.mod/module.cue
,timoni.cue
,values.cue
).
NewLocal
Function:
- Creates a new
Local
instance with the given source and destination paths. - Initializes the
requiredFiles
slice with the expected file paths.
GetModuleRoot
Method:
- Returns the path to the module’s root directory within the destination path, which is
dst/module
.
Fetch
Method:
- Checks if the source path (
src
) exists and is a directory. If not, it returns an error. - Verifies that all required files exist within the module directory. If any are missing, it returns an error.
- Creates a
ModuleReference
struct: Repository
: The source path of the module.Version
: The default development version (“devel”).Digest
: “unknown” as it’s a local module.- Copies the module from the source to the module root directory (
dst/module
) using theengine.CopyModule
function. - Returns the
ModuleReference
and any error that occurred during the copy process.
Purpose:
This code allows Timoni to retrieve CUE modules that are located locally on the file system. It ensures the necessary files are present within the module and copies them to the specified destination for further processing.
Key Points:
- The
Local
struct represents a local module source. - The
NewLocal
function initializes a newLocal
instance. - The
GetModuleRoot
method provides the module’s root directory. - The
Fetch
method performs the retrieval and copying of the module, and returns metadata about the module. - The
engine.CopyModule
function handles the actual file copying process.
Overall:
This code defines a simple yet efficient way to handle local Timoni module retrieval and ensures that the necessary files are present for successful module compilation.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph