Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Fix missing deps when not using dep or modules (#1667)
Browse files Browse the repository at this point in the history
* Fix missing deps when not using dep or modules

Fixes #1622 #1612

* Fix tests

* fixing broken test

* updating helpers version
  • Loading branch information
stanislas-m authored and markbates committed May 26, 2019
1 parent d853e14 commit 27e7c15
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
16 changes: 16 additions & 0 deletions genny/newapp/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/gobuffalo/buffalo/genny/newapp/core"
"github.com/gobuffalo/genny"
"github.com/gobuffalo/gogen"
"github.com/gobuffalo/gogen/gomods"
"github.com/gobuffalo/packr/v2"
)

Expand Down Expand Up @@ -33,5 +34,20 @@ func New(opts *Options) (*genny.Group, error) {

gg.Add(g)

// DEP/MODS/go get should be last
if !opts.App.WithDep && !opts.App.WithModules {
g := genny.New()
g.Command(gogen.Get("./...", "-t"))
gg.Add(g)
}

if opts.App.WithModules {
g, err := gomods.Tidy(opts.App.Root, false)
if err != nil {
return gg, err
}
gg.Add(g)
}

return gg, nil
}
1 change: 1 addition & 0 deletions genny/newapp/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func Test_New(t *testing.T) {

cmds := []string{"go get github.com/gobuffalo/buffalo-plugins",
"go get -t ./...",
"go get -t ./...",
}
r.Len(res.Commands, len(cmds))

Expand Down
16 changes: 16 additions & 0 deletions genny/newapp/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/gobuffalo/buffalo/genny/newapp/core"
"github.com/gobuffalo/genny"
"github.com/gobuffalo/gogen"
"github.com/gobuffalo/gogen/gomods"
"github.com/gobuffalo/packr/v2"
)

Expand Down Expand Up @@ -54,5 +55,20 @@ func New(opts *Options) (*genny.Group, error) {
gg.Add(g)
}

// DEP/MODS/go get should be last
if !opts.App.WithDep && !opts.App.WithModules {
g := genny.New()
g.Command(gogen.Get("./...", "-t"))
gg.Add(g)
}

if opts.App.WithModules {
g, err := gomods.Tidy(opts.App.Root, false)
if err != nil {
return gg, err
}
gg.Add(g)
}

return gg, nil
}
1 change: 1 addition & 0 deletions genny/newapp/web/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func Test_New(t *testing.T) {

cmds := []string{"go get github.com/gobuffalo/buffalo-plugins",
"go get -t ./...",
"go get -t ./...",
}
r.Len(res.Commands, len(cmds))

Expand Down

0 comments on commit 27e7c15

Please sign in to comment.