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

Commit

Permalink
Update dependencies after buffalo new (#2128)
Browse files Browse the repository at this point in the history
* Update dependencies after buffalo new

* Cleanup
  • Loading branch information
fasmat authored Aug 3, 2021
1 parent 75233c6 commit 1e27d00
Show file tree
Hide file tree
Showing 10 changed files with 524 additions and 59 deletions.
11 changes: 1 addition & 10 deletions buffalo.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,4 @@ package buffalo
// this import the package doesn't get vendored
// by go mod vendor or by dep. this import fixes
// this problem.
import "github.com/gobuffalo/buffalo/runtime"

var version string

func init() {
// this is here to make sure that goimports
// doesn't remove the runtime import because
// it isn't being used.
version = runtime.Version
}
import _ "github.com/gobuffalo/buffalo/runtime"
3 changes: 3 additions & 0 deletions buffalo/cmd/fix/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func (pf Plugins) Reinstall(r *Runner) error {
App: r.App,
Plugins: plugs.List(),
})
if err != nil {
return err
}

run.WithGroup(gg)

Expand Down
35 changes: 31 additions & 4 deletions buffalo/cmd/new.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cmd

import (
"bufio"
"bytes"
"context"
"fmt"
"os"
Expand Down Expand Up @@ -188,7 +190,7 @@ var newCmd = &cobra.Command{
}
if app.WithWebpack {
wo.Webpack = &webpack.Options{}
} else if !app.AsAPI {
} else {
wo.Standard = &standard.Options{}
}
gg, err = web.New(wo)
Expand All @@ -199,13 +201,38 @@ var newCmd = &cobra.Command{
}
return err
}
run.WithGroup(gg)

g := genny.New()
g.Command(exec.Command("go", "mod", "tidy"))
if err := run.With(g); err != nil {
gg.Add(g)

g = genny.New()
g.RunFn(func(r *genny.Runner) error {
deps, err := exec.Command("go", "list", "-f", "{{if not (or .Main .Indirect)}}{{.Path}}{{end}}", "-m", "all").Output()
if err != nil {
return err
}

scanner := bufio.NewScanner(bytes.NewReader(deps))
for scanner.Scan() {
if err := exec.Command("go", "get", scanner.Text()).Run(); err != nil {
return err
}
}

if err := scanner.Err(); err != nil {
return err
}

return nil
}
})
gg.Add(g)

g = genny.New()
g.Command(exec.Command("go", "mod", "tidy"))
gg.Add(g)

run.WithGroup(gg)

if err := run.WithNew(gogen.Fmt(app.Root)); err != nil {
return err
Expand Down
4 changes: 1 addition & 3 deletions buffalo/cmd/plugins/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ var listCmd = &cobra.Command{
var cmds pluginsin.Commands

for _, l := range list {
for _, c := range l {
cmds = append(cmds, c)
}
cmds = append(cmds, l...)
}

sort.Slice(cmds, func(i, j int) bool {
Expand Down
8 changes: 0 additions & 8 deletions genny/build/build-packr.go

This file was deleted.

8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/gobuffalo/packd v1.0.0
github.com/gobuffalo/packr/v2 v2.8.1
github.com/gobuffalo/plush/v4 v4.1.5
github.com/gobuffalo/pop/v5 v5.3.3
github.com/gobuffalo/pop/v5 v5.3.4
github.com/gobuffalo/tags/v3 v3.1.0
github.com/google/go-cmp v0.5.6
github.com/gorilla/handlers v1.5.1
Expand All @@ -36,12 +36,12 @@ require (
github.com/markbates/sigtx v1.0.0
github.com/monoculum/formam v0.0.0-20210523135142-1af3317b7b9b
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.1.3
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.1
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.7.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/tools v0.1.3
golang.org/x/tools v0.1.5
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
gopkg.in/yaml.v2 v2.4.0
)
500 changes: 479 additions & 21 deletions go.sum

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import (

// LoadPlugins will add listeners for any plugins that support "events"
func LoadPlugins() error {
var err error
var errResult error
oncer.Do("events.LoadPlugins", func() {
// don't send plugins events during testing
if envy.Get("GO_ENV", "development") == "test" {
return
}
plugs, err := plugins.Available()
if err != nil {
err = err
errResult = err
return
}
for _, cmds := range plugs {
Expand Down Expand Up @@ -57,12 +57,11 @@ func LoadPlugins() error {
})
}(c)
if err != nil {
err = err
errResult = err
return
}
}

}
})
return err
return errResult
}
4 changes: 1 addition & 3 deletions plugins/decorate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ var ErrPlugMissing = fmt.Errorf("plugin missing")
func Decorate(c Command) *cobra.Command {
var flags []string
if len(c.Flags) > 0 {
for _, f := range c.Flags {
flags = append(flags, f)
}
flags = append(flags, c.Flags...)
}
cc := &cobra.Command{
Use: c.Name,
Expand Down
1 change: 0 additions & 1 deletion runtime/runtime.go

This file was deleted.

0 comments on commit 1e27d00

Please sign in to comment.