-
Notifications
You must be signed in to change notification settings - Fork 53
Refactor loading modules and creating project data #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Split prompting into a few smaller, more specific functions Split module tests into internal and external
| projectParameters := promptAllModules(moduleConfig) | ||
| for _ = range projectParameters { | ||
| // TODO: Add parameters to module structs inside project | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being able to call these functions and have a list of all the module configs keyed by module name, and all parameters filled by the user was the core of this refactor, as all this information is required by other logic to come in this function.
| return &projectConfig | ||
| } | ||
|
|
||
| func promptAllModules(projectConfig *projectconfig.ZeroProjectConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This did too much stuff.
| } | ||
| templateModules = append(templateModules, mod) | ||
| } | ||
| // Initiate all the modules defined in the config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out until we work on generation.
| if !IsLocal(templateModule.Source) { | ||
| err := getter.Get(sourcePath, templateModule.Source, getter.WithProgress(p)) | ||
| // FetchModule downloads the remote module source (or loads the local files) and parses the module config yaml | ||
| func FetchModule(source string) (moduleconfig.ModuleConfig, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now accepts a single module source (directory or url) and returns the config of that project.
| } | ||
|
|
||
| // TODO : Use this function signature instead | ||
| func PromptParams(moduleConfig moduleconfig.ModuleConfig, parameters map[string]string) (map[string]string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for David, you'll have to tie your refactoring in here.
Preserve backward compatibility Co-authored-by: David Cheung <davidcheung@live.ca>
Split prompting into a few smaller, more specific functions
Split module tests into internal and external