Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bmonkman committed Jun 17, 2020
1 parent 2321b10 commit 827cb9e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 92 deletions.
2 changes: 1 addition & 1 deletion internal/config/projectconfig/project_config_test.go
Expand Up @@ -25,7 +25,7 @@ func TestLoadConfig(t *testing.T) {
Modules: eksGoReactSampleModules(),
}

t.Run("Should load and unmarshall config correctly", func(t *testing.T) {
t.Run("Should load and unmarshal config correctly", func(t *testing.T) {
got := projectconfig.LoadConfig(filePath)
if !cmp.Equal(want, got, cmpopts.EquateEmpty()) {
t.Errorf("projectconfig.ZeroProjectConfig.Unmarshal mismatch (-want +got):\n%s", cmp.Diff(want, got))
Expand Down
80 changes: 0 additions & 80 deletions internal/generate/generate_infrastructure.go

This file was deleted.

22 changes: 13 additions & 9 deletions internal/generate/generate_modules.go
Expand Up @@ -31,7 +31,7 @@ func Generate(projectConfig projectconfig.ZeroProjectConfig) error {
}
wg.Wait()

flog.Infof(":pencil: Rendering Modules")
flog.Infof(":memo: Rendering Modules")
for _, mod := range projectConfig.Modules {
// Load module configuration
moduleConfig, err := module.ParseModuleConfig(mod.Files.Source)
Expand All @@ -52,11 +52,15 @@ func Generate(projectConfig projectconfig.ZeroProjectConfig) error {
mod.Parameters,
}

fileTemplates := NewTemplates(moduleDir, outputDir, false)
fileTemplates := newTemplates(moduleDir, outputDir, false)

ExecuteTemplates(fileTemplates, templateData, delimiters)
executeTemplates(fileTemplates, templateData, delimiters)
}

flog.Infof(":up_arrow: Done Rendering - committing repositories to version control")
// TODO : Integrate this work

flog.Infof(":check_mark_button: Done - run zero apply to create any required infrastructure or execute any other remote commands to prepare your environments.")
return nil
}

Expand All @@ -66,11 +70,11 @@ type TemplateConfig struct {
isTemplate bool
}

// NewTemplates walks the module directory to find all to be templated
func NewTemplates(moduleDir string, outputDir string, overwrite bool) []*TemplateConfig {
// newTemplates walks the module directory to find all to be templated
func newTemplates(moduleDir string, outputDir string, overwrite bool) []*TemplateConfig {
templates := []*TemplateConfig{}

paths, err := GetAllFilePathsInDirectory(moduleDir)
paths, err := getAllFilePathsInDirectory(moduleDir)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -104,8 +108,8 @@ func NewTemplates(moduleDir string, outputDir string, overwrite bool) []*Templat
return templates
}

// GetAllFilePathsInDirectory Recursively get all file paths in directory, including sub-directories.
func GetAllFilePathsInDirectory(moduleDir string) ([]string, error) {
// getAllFilePathsInDirectory Recursively get all file paths in directory, including sub-directories.
func getAllFilePathsInDirectory(moduleDir string) ([]string, error) {
var paths []string
err := filepath.Walk(moduleDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
Expand All @@ -123,7 +127,7 @@ func GetAllFilePathsInDirectory(moduleDir string) ([]string, error) {
return paths, nil
}

func ExecuteTemplates(templates []*TemplateConfig, data interface{}, delimiters []string) {
func executeTemplates(templates []*TemplateConfig, data interface{}, delimiters []string) {
var wg sync.WaitGroup
leftDelim := delimiters[0]
rightDelim := delimiters[1]
Expand Down
1 change: 0 additions & 1 deletion internal/generate/github/test/config1.yml

This file was deleted.

1 change: 0 additions & 1 deletion internal/generate/github/test/dir/config2.yml

This file was deleted.

0 comments on commit 827cb9e

Please sign in to comment.