(name string, tmplType extensions.ExtTemplateType)
| 610 | var buildScript []byte |
| 611 | |
| 612 | func (m *Manager) Create(name string, tmplType extensions.ExtTemplateType) error { |
| 613 | if _, err := m.gitClient.CommandOutput([]string{"init", "--quiet", name}); err != nil { |
| 614 | return err |
| 615 | } |
| 616 | |
| 617 | if tmplType == extensions.GoBinTemplateType { |
| 618 | return m.goBinScaffolding(name) |
| 619 | } else if tmplType == extensions.OtherBinTemplateType { |
| 620 | return m.otherBinScaffolding(name) |
| 621 | } |
| 622 | |
| 623 | script := fmt.Sprintf(scriptTmpl, name) |
| 624 | if err := writeFile(filepath.Join(name, name), []byte(script), 0755); err != nil { |
| 625 | return err |
| 626 | } |
| 627 | |
| 628 | scopedClient := m.gitClient.ForRepo(name) |
| 629 | if _, err := scopedClient.CommandOutput([]string{"add", name, "--chmod=+x"}); err != nil { |
| 630 | return err |
| 631 | } |
| 632 | |
| 633 | if _, err := scopedClient.CommandOutput([]string{"commit", "-m", "initial commit"}); err != nil { |
| 634 | return ErrInitialCommitFailed |
| 635 | } |
| 636 | |
| 637 | return nil |
| 638 | } |
| 639 | |
| 640 | func (m *Manager) otherBinScaffolding(name string) error { |
| 641 | if err := writeFile(filepath.Join(name, ".github", "workflows", "release.yml"), otherBinWorkflow, 0644); err != nil { |
nothing calls this directly
no test coverage detected