Skip to content

Conversation

@bmonkman
Copy link
Contributor

@bmonkman bmonkman commented Jun 5, 2020

Split prompting into a few smaller, more specific functions
Split module tests into internal and external

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
}
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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>
@bmonkman bmonkman merged commit 1521c10 into master Jun 5, 2020
@bmonkman bmonkman deleted the refactor-loading-modules branch June 5, 2020 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants