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

Commit

Permalink
clear the plugins cache and re-install plugins when running `buffalo …
Browse files Browse the repository at this point in the history
…fix` (#1705)
  • Loading branch information
markbates authored Jun 22, 2019
1 parent 45f1a02 commit 0edecd7
Show file tree
Hide file tree
Showing 30 changed files with 60 additions and 29 deletions.
1 change: 1 addition & 0 deletions buffalo/cmd/fix/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var checks = []Check{
DeprecrationsCheck,
fixDocker,
encodeApp,
Plugins,
}

func encodeApp(r *Runner) error {
Expand Down
34 changes: 34 additions & 0 deletions buffalo/cmd/fix/plugins.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package fix

import (
"context"
"fmt"
"os"

"github.com/gobuffalo/buffalo/genny/plugins/install"
"github.com/gobuffalo/buffalo/plugins"
"github.com/gobuffalo/buffalo/plugins/plugdeps"
"github.com/gobuffalo/genny"
"github.com/pkg/errors"
)

// Plugins will fix plugins between releases
func Plugins(r *Runner) error {
fmt.Println("~~~ Cleaning plugins cache ~~~")
os.RemoveAll(plugins.CachePath)
plugs, err := plugdeps.List(r.App)
if err != nil && (errors.Cause(err) != plugdeps.ErrMissingConfig) {
return errors.WithStack(err)
}

run := genny.WetRunner(context.Background())
gg, err := install.New(&install.Options{
App: r.App,
Plugins: plugs.List(),
})

run.WithGroup(gg)

fmt.Println("~~~ Reinstalling plugins ~~~")
return run.Run()
}
4 changes: 2 additions & 2 deletions buffalo/cmd/plugins/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"
"strings"

"github.com/gobuffalo/buffalo/genny/plugin"
"github.com/gobuffalo/buffalo/genny/plugin/with"
"github.com/gobuffalo/buffalo/genny/plugins/plugin"
"github.com/gobuffalo/buffalo/genny/plugins/plugin/with"
"github.com/gobuffalo/envy"
"github.com/gobuffalo/genny"
"github.com/gobuffalo/gogen"
Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/plugins/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path"
"strings"

"github.com/gobuffalo/buffalo/genny/install"
"github.com/gobuffalo/buffalo/genny/plugins/install"
"github.com/gobuffalo/buffalo/plugins/plugdeps"
"github.com/gobuffalo/genny"
"github.com/gobuffalo/logger"
Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/plugins/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package plugins
import (
"context"

"github.com/gobuffalo/buffalo/genny/install"
"github.com/gobuffalo/buffalo/genny/plugins/install"
"github.com/gobuffalo/buffalo/plugins"
"github.com/gobuffalo/events"
"github.com/gobuffalo/genny"
Expand Down
2 changes: 1 addition & 1 deletion genny/newapp/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/gobuffalo/buffalo-docker/genny/docker"
pop "github.com/gobuffalo/buffalo-pop/genny/newapp"
"github.com/gobuffalo/buffalo/genny/ci"
"github.com/gobuffalo/buffalo/genny/install"
"github.com/gobuffalo/buffalo/genny/plugins/install"
"github.com/gobuffalo/buffalo/genny/refresh"
"github.com/gobuffalo/buffalo/plugins/plugdeps"
"github.com/gobuffalo/buffalo/runtime"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

"github.com/gobuffalo/buffalo/genny/plugin"
"github.com/gobuffalo/buffalo/genny/plugins/plugin"
"github.com/gobuffalo/genny"
"github.com/gobuffalo/genny/genny/new"
"github.com/gobuffalo/packr/v2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"testing"

"github.com/gobuffalo/buffalo/genny/plugin"
"github.com/gobuffalo/buffalo/genny/plugins/plugin"
"github.com/gobuffalo/genny"
"github.com/gobuffalo/genny/gentest"
"github.com/gobuffalo/gogen/gomods"
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754
github.com/gobuffalo/tags v2.1.0+incompatible
github.com/gobuffalo/x v0.0.0-20190614162758-d80e318e1bb4
github.com/gorilla/context v1.1.1
github.com/gorilla/mux v1.7.2
github.com/gorilla/sessions v1.1.3
github.com/karrick/godirwalk v1.10.12
Expand Down
36 changes: 18 additions & 18 deletions packrd/packed-packr.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions route_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/pkg/errors"

"github.com/gobuffalo/events"
gcontext "github.com/gorilla/context"
"github.com/gorilla/mux"
)

Expand Down Expand Up @@ -92,8 +91,6 @@ func (ri *RouteInfo) BuildPathHelper() RouteHelperFunc {
}

func (ri RouteInfo) ServeHTTP(res http.ResponseWriter, req *http.Request) {
defer gcontext.Clear(req)

a := ri.App

c := a.newContext(ri, res, req)
Expand Down

0 comments on commit 0edecd7

Please sign in to comment.