Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 0 additions & 198 deletions Gopkg.lock

This file was deleted.

42 changes: 0 additions & 42 deletions Gopkg.toml

This file was deleted.

3 changes: 3 additions & 0 deletions application.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type RepoHooker interface {
RepoPrePushHook() error
RepoPostMergeHook() error
RepoPostCommitHook() error
RepoRemovePrePushHook() error
RepoRemovePostMergeHook() error
RepoRemovePostCommitHook() error
}

type Application struct {
Expand Down
8 changes: 8 additions & 0 deletions cmd/cobra_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,20 @@ func commandGitHooks(harness *CobraHarness) *cobra.Command {
Args: cobra.ExactArgs(1),
Example: "$ spec git-hook exec pre-push",
}
remove := &cobra.Command{
Use: "remove <pre-push|post-merge|post-commit|all>",
Aliases: []string{"rm"},
Args: cobra.ExactArgs(1),
Example: "$ spec git-hook remove all",
}

root.AddCommand(
exec,
remove,
)

exec.RunE = harness.GitHookExec
remove.RunE = harness.GitHookRemove

return root
}
Expand Down
23 changes: 23 additions & 0 deletions cmd/cobra_harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,29 @@ func (c *CobraHarness) GitHookExec(cmd *cobra.Command, args []string) error {
return c.errorWithReturnCode(cmd, 1, fmt.Errorf("invalid hook name : %s", args[0]))
}

func (c *CobraHarness) GitHookRemove(cmd *cobra.Command, args []string) error {
switch args[0] {
case "pre-push":
return c.errorOrNil(cmd, 1, c.app.RepoHooker.RepoRemovePrePushHook())
case "post-merge":
return c.errorOrNil(cmd, 1, c.app.RepoHooker.RepoRemovePostMergeHook())
case "post-commit":
return c.errorOrNil(cmd, 1, c.app.RepoHooker.RepoRemovePostCommitHook())
case "all":
if err := c.errorOrNil(cmd, 1, c.app.RepoHooker.RepoRemovePrePushHook()); err != nil {
return err
}

if err := c.errorOrNil(cmd, 1, c.app.RepoHooker.RepoRemovePostMergeHook()); err != nil {
return err
}

return c.errorOrNil(cmd, 1, c.app.RepoHooker.RepoRemovePostCommitHook())
}

return c.errorWithReturnCode(cmd, 1, fmt.Errorf("invalid hook name : %s", args[0]))
}

func (c *CobraHarness) Pull(cmd *cobra.Command, args []string) error {
return c.errorOrNil(cmd, 1, c.app.PushPuller.Pull())
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (t *testHarness) iHaveNotSetAGitRemote() error {

func (t *testHarness) overwriteHooks() error {
goPath := os.Getenv("GOPATH")
cmd := "go run " + filepath.Join(
cmd := "GO111MODULE=off go run " + filepath.Join(
goPath,
"src/github.com/endiangroup/specstack/cmd/spec/*.go",
)
Expand Down Expand Up @@ -457,7 +457,7 @@ func (t *testHarness) iHaveAProperlyConfiguredProjectDirectory() error {
return err
}

_, f, _, _ := runtime.Caller(1)
_, f, _, _ := runtime.Caller(0)
var err error
t.gitServer, err = gitest.NewServer(filepath.Join(path.Dir(f), "fixtures/git/starting"))
if err != nil {
Expand Down Expand Up @@ -513,7 +513,7 @@ func (t *testHarness) iShouldSeeAnAppropriateWarningFromGit() error {
}

func (t *testHarness) thereAreNewMetadataOnTheRemoteGitServer() error {
_, f, _, _ := runtime.Caller(1)
_, f, _, _ := runtime.Caller(0)
p := filepath.Join(path.Dir(f), "fixtures/git/with-commits")
return t.gitServer.SetTemplate(p)
}
Expand Down Expand Up @@ -647,7 +647,7 @@ func (t *testHarness) iRunAnySpecMetadataCommand() error {

func (t *testHarness) thereAreMinorChangesToScenarioOnTheRemoteGitServer(scenario string) error {
var err error
_, f, _, _ := runtime.Caller(1)
_, f, _, _ := runtime.Caller(0)
t.gitServer, err = gitest.NewServer(filepath.Join(path.Dir(f), "fixtures/git/minor-changes"))
if err != nil {
return err
Expand Down
25 changes: 25 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module github.com/endiangroup/specstack

go 1.13

require (
github.com/DATA-DOG/godog v0.7.13
github.com/antzucaro/matchr v0.0.0-20180616170659-cbc221335f3c
github.com/cucumber/gherkin-go v0.0.0-20181022222825-04ff9f06a694
github.com/cucumber/gherkin-go/v8 v8.2.1+incompatible
github.com/davecgh/go-spew v1.1.1
github.com/endiangroup/gitest v0.0.0-20181129112818-8bd9873832d2
github.com/endiangroup/pretty-formatter-go v0.0.0-20200412175208-99fc86d6539f
github.com/endiangroup/snaptest v0.0.0-20180313142837-2524ada5b728
github.com/gogo/protobuf v1.3.1
github.com/heroku/pat v0.0.0-20141001185247-95f5f62e9694
github.com/inconshreveable/mousetrap v1.0.0
github.com/pmezard/go-difflib v1.0.0
github.com/sanity-io/litter v1.1.0
github.com/spf13/afero v1.1.2
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.2
github.com/stretchr/objx v0.1.1
github.com/stretchr/testify v1.4.0
golang.org/x/text v0.3.0
)
Loading