| 158 | return err |
| 159 | } |
| 160 | func writeTemplate(filePath string, templateName string) error { |
| 161 | gofile, err := os.Create(filePath) |
| 162 | if err != nil { |
| 163 | log.Println("ERROR", err) |
| 164 | return err |
| 165 | } |
| 166 | defer gofile.Close() |
| 167 | tpl := template.Must(template.New("component").Parse(templateName)) |
| 168 | // TODO - get the gopath of cwd and pass it in a context below to this call |
| 169 | err = tpl.Execute(gofile, nil) |
| 170 | if err != nil { |
| 171 | return err |
| 172 | } |
| 173 | return nil |
| 174 | } |
| 175 | func makeDirectories(cwd string) error { |
| 176 | for _, dir := range directories { |
| 177 | err := os.MkdirAll(filepath.Join(cwd, appName, dir), 0755) |