8
8
"flag"
9
9
"fmt"
10
10
"io"
11
+ "log"
11
12
"os"
12
13
"path"
13
14
"path/filepath"
@@ -17,20 +18,6 @@ import (
17
18
"github.com/EliCDavis/polyform/nodes"
18
19
)
19
20
20
- type producerCache map [string ]Artifact
21
-
22
- func (pc producerCache ) Lookup (producer string ) Artifact {
23
- if pc == nil {
24
- return nil
25
- }
26
-
27
- if artifact , ok := pc [producer ]; ok {
28
- return artifact
29
- }
30
-
31
- return nil
32
- }
33
-
34
21
type App struct {
35
22
Name string
36
23
Version string
@@ -43,23 +30,6 @@ type App struct {
43
30
nodeIDs map [nodes.Node ]string
44
31
}
45
32
46
- func writeJSONError (out io.Writer , err error ) error {
47
- var d struct {
48
- Error string `json:"error"`
49
- } = struct {
50
- Error string `json:"error"`
51
- }{
52
- Error : err .Error (),
53
- }
54
- data , err := json .Marshal (d )
55
- if err != nil {
56
- return err
57
- }
58
-
59
- _ , err = out .Write (data )
60
- return err
61
- }
62
-
63
33
func writeProducersToZip (path string , producers map [string ]nodes.NodeOutput [Artifact ], zw * zip.Writer ) error {
64
34
if producers == nil {
65
35
panic ("can't write nil producers" )
@@ -103,19 +73,19 @@ func (a App) getParameters() []Parameter {
103
73
for p := range parameterSet {
104
74
uniqueParams = append (uniqueParams , p )
105
75
}
76
+
77
+ log .Printf ("Params found %v" , uniqueParams )
106
78
return uniqueParams
107
79
}
108
80
109
81
func recurseDependenciesType [T any ](dependent nodes.Dependent ) []T {
110
82
allDependencies := make ([]T , 0 )
111
83
for _ , dep := range dependent .Dependencies () {
112
- subDependent , ok := dep .(nodes.Dependent )
113
- if ok {
114
- subDependencies := recurseDependenciesType [T ](subDependent )
115
- allDependencies = append (allDependencies , subDependencies ... )
116
- }
84
+ subDependent := dep .Dependency ()
85
+ subDependencies := recurseDependenciesType [T ](subDependent )
86
+ allDependencies = append (allDependencies , subDependencies ... )
117
87
118
- ofT , ok := dep .(T )
88
+ ofT , ok := subDependent .(T )
119
89
if ok {
120
90
allDependencies = append (allDependencies , ofT )
121
91
}
@@ -296,7 +266,7 @@ func (a *App) Run() error {
296
266
Aliases : []string {"serve" },
297
267
Run : func () error {
298
268
serveCmd := flag .NewFlagSet ("serve" , flag .ExitOnError )
299
- // a.initialize(serveCmd)
269
+ a .initialize (serveCmd )
300
270
hostFlag := serveCmd .String ("host" , "localhost" , "interface to bind to" )
301
271
portFlag := serveCmd .String ("port" , "8080" , "port to serve over" )
302
272
0 commit comments