GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactor loading modules and creating project data by bmonkman · Pull Request #147 · commitdev/zero

Conversation

@bmonkman

@bmonkman bmonkman commented Jun 5, 2020

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bmonkman
Refactor loading modules and creating project data
f363ba0
Split prompting into a few smaller, more specific functions
Split module tests into internal and external
@bmonkman
bmonkman requested review from Direside, davidcheung and dtoki June 5, 2020 22:21
bmonkman
bmonkman commented Jun 5, 2020
View reviewed changes
Comment thread internal/context/init.go
projectParameters := promptAllModules(moduleConfig)
for _ = range projectParameters {
// TODO: Add parameters to module structs inside project
}

@bmonkman bmonkman Jun 5, 2020

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman commented Jun 5, 2020
View reviewed changes
Comment thread internal/context/init.go
return &projectConfig
}

func promptAllModules(projectConfig *projectconfig.ZeroProjectConfig) {

@bmonkman bmonkman Jun 5, 2020

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman commented Jun 5, 2020
View reviewed changes
Comment thread internal/generate/generate_modules.go
}
templateModules = append(templateModules, mod)
}
// Initiate all the modules defined in the config

@bmonkman bmonkman Jun 5, 2020

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman commented Jun 5, 2020
View reviewed changes
Comment thread internal/module/module.go
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) {

@bmonkman bmonkman Jun 5, 2020

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman commented Jun 5, 2020
View reviewed changes
Comment thread internal/module/module.go
}

// TODO : Use this function signature instead
func PromptParams(moduleConfig moduleconfig.ModuleConfig, parameters map[string]string) (map[string]string, error) {

@bmonkman bmonkman Jun 5, 2020

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

davidcheung reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
davidcheung
davidcheung approved these changes Jun 5, 2020
View reviewed changes
Comment thread internal/context/init.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/context/init.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bmonkman @davidcheung
Update internal/context/init.go
2c6897f
Preserve backward compatibility

Co-authored-by: David Cheung <[email protected]>
dtoki
dtoki approved these changes Jun 5, 2020
View reviewed changes
@bmonkman
Changed pluralization
ab95383
@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

Reviewers

@Direside Direside Awaiting requested review from Direside
2 more reviewers
@davidcheung davidcheung davidcheung approved these changes
@dtoki dtoki dtoki approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@bmonkman @davidcheung @dtoki
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.