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