Skip to content

Commit

Permalink
Merge pull request #35 from davidovich/34-add-git-repo-to-scaffold
Browse files Browse the repository at this point in the history
adds git initialization to scaffolded asset repo
  • Loading branch information
davidovich authored May 9, 2019
2 parents 786501b + f01a3f5 commit 7c3daa4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $(SCAFFOLD_BIN): $(PACKR_FILE)

$(PACKR_FILE): $(ASSETS)
ifndef HAS_PACKR2
go get -u github.com/gobuffalo/packr/v2/packr2
gobin github.com/gobuffalo/packr/v2/packr2
endif
packr2

Expand Down
12 changes: 12 additions & 0 deletions scaffold/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package main
import (
"fmt"
"os"
"os/exec"

"github.com/davidovich/summon/pkg/scaffold"
"github.com/davidovich/summon/pkg/command"
"github.com/spf13/cobra"
)

Expand All @@ -21,6 +23,8 @@ func execute(rootCmd *cobra.Command) int {
return 0
}

var execCmd = command.New

func newMainCmd() *cobra.Command {
var dest string
var force bool
Expand All @@ -39,6 +43,14 @@ func newMainCmd() *cobra.Command {
err := scaffold.Create(dest, args[0], summonName, force)
if err == nil {
fmt.Println("Successfully scaffolded a summon asset repo")
git, err := exec.LookPath("git")
if err != nil {
fmt.Println("Warn: could not find git on PATH to initialize repository")
return nil
}
gitcmd := execCmd(git, "-C", dest, "init")
gitcmd.Stdout = os.Stdout
_ = gitcmd.Run()
}
return err
},
Expand Down

0 comments on commit 7c3daa4

Please sign in to comment.