This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-349) Move install logic from config_processor
Prior to this commit, the private processor included the ProcessConfig public function which called the private functions readConfig and setupTemplateNamespace to place a package in the right folder structure so that it is recognized as an installed package. This is an install function placed in the config processor. This commit replaces the ProcessConfig function in the config_processor.ConfigProcessorI interface with GetConfigMetadata, which returns the new ConfigMetadata struct also newly defined in config_processor. This enables a consumer of a ConfigProcessorI implementation to retrieve the metadata needed to install a package generically. The prior implementation conflated configuration processing with install logic. This commit adds a new public function to the install package, InstallFromConfig. This function combines the logic from the removed ProcessConfig and setupTemplateNamespace functions from the private config processor, genericising it in the process. This commit extends the install.Installer struct to take a config file name, so that no hard coding of the config file name is needed in the package; this makes it generically reusable regardless of config file.
- Loading branch information
petergmurphy
committed
Feb 16, 2022
1 parent
b3ea9d2
commit 51f0502
Showing
4 changed files
with
69 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
package config_processor | ||
|
||
type ConfigProcessorI interface { | ||
ProcessConfig(sourceDir, targetDir string, force bool) (string, error) | ||
GetConfigMetadata(configFile string) (metadata ConfigMetadata, err error) | ||
CheckConfig(configFile string) error | ||
} | ||
|
||
type ConfigMetadata struct { | ||
Id string | ||
Author string | ||
Version string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters