@@ -44,8 +44,9 @@ Only a single environment may be suitable for an initial test, but for a real sy
4444
4545 applyAll (rootDir , * projectConfig , environments )
4646
47- // TODO Summary
48- flog .Infof (":check_mark_button: Done - Summary goes here." )
47+ flog .Infof (":check_mark_button: Done." )
48+
49+ summarizeAll (rootDir , * projectConfig , environments )
4950}
5051
5152func applyAll (dir string , projectConfig projectconfig.ZeroProjectConfig , applyEnvironments []string ) {
@@ -127,3 +128,39 @@ func validateEnvironments(applyEnvironments []string) {
127128 }
128129 }
129130}
131+
132+ func summarizeAll (dir string , projectConfig projectconfig.ZeroProjectConfig , applyEnvironments []string ) {
133+ flog .Infof ("Your projects and infrastructure have been successfully created. Here are some useful links and commands to get you started:" )
134+
135+ graph := projectConfig .GetDAG ()
136+
137+ // Walk the graph of modules and run `make summary`
138+ root := []dag.Vertex {projectconfig .GraphRootName }
139+ graph .DepthFirstWalk (root , func (v dag.Vertex , depth int ) error {
140+ // Don't process the root
141+ if depth == 0 {
142+ return nil
143+ }
144+
145+ name := v .(string )
146+ mod := projectConfig .Modules [name ]
147+ // Add env vars for the makefile
148+ envList := []string {
149+ fmt .Sprintf ("ENVIRONMENT=%s" , strings .Join (applyEnvironments , "," )),
150+ fmt .Sprintf ("REPOSITORY=%s" , mod .Files .Repository ),
151+ }
152+
153+ modulePath := module .GetSourceDir (mod .Files .Source )
154+ // Passed in `dir` will only be used to find the project path, not the module path,
155+ // unless the module path is relative
156+ if module .IsLocal (mod .Files .Source ) && ! filepath .IsAbs (modulePath ) {
157+ modulePath = filepath .Join (dir , modulePath )
158+ }
159+
160+ envList = util .AppendProjectEnvToCmdEnv (mod .Parameters , envList )
161+ util .ExecuteCommand (exec .Command ("make" , "summary" ), modulePath , envList )
162+ return nil
163+ })
164+
165+ flog .Infof ("Happy coding! :smile:" )
166+ }
0 commit comments