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

Reduce dependencies on external libraries #2260

Merged
merged 4 commits into from
May 15, 2022
Merged
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
10 changes: 5 additions & 5 deletions default_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func Test_DefaultContext_GetSet(t *testing.T) {
r.Equal("Mark", c.Value("name").(string))
}

func Test_DefaultContext_Set_Unconfigured(t *testing.T) {
func Test_DefaultContext_Set_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}

Expand All @@ -162,7 +162,7 @@ func Test_DefaultContext_Value(t *testing.T) {
r.Equal("Mark", c.Value("name").(string))
}

func Test_DefaultContext_Value_Unconfigured(t *testing.T) {
func Test_DefaultContext_Value_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}
r.Nil(c.Value("name"))
Expand Down Expand Up @@ -323,7 +323,7 @@ func Test_DefaultContext_Data(t *testing.T) {
r.EqualValues(map[string]interface{}{}, c.Data())
}

func Test_DefaultContext_Data_Unconfigured(t *testing.T) {
func Test_DefaultContext_Data_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}

Expand All @@ -345,7 +345,7 @@ func Test_DefaultContext_String_EmptyData(t *testing.T) {
r.EqualValues("", c.String())
}

func Test_DefaultContext_String_EmptyData_Unconfigured(t *testing.T) {
func Test_DefaultContext_String_EmptyData_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}

Expand All @@ -372,7 +372,7 @@ func Test_DefaultContext_MarshalJSON_EmptyData(t *testing.T) {
r.EqualValues(`{}`, string(jb))
}

func Test_DefaultContext_MarshalJSON_EmptyData_Unconfigured(t *testing.T) {
func Test_DefaultContext_MarshalJSON_EmptyData_not_configured(t *testing.T) {
r := require.New(t)
c := DefaultContext{}

Expand Down
9 changes: 0 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,14 @@ require (
github.com/gobuffalo/plush/v4 v4.1.11
github.com/gobuffalo/pop/v6 v6.0.2
github.com/gobuffalo/tags/v3 v3.1.2
github.com/google/go-cmp v0.5.6 // indirect
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/gorilla/sessions v1.2.1
github.com/karrick/godirwalk v1.16.1
github.com/markbates/grift v1.5.0
github.com/markbates/oncer v1.0.0
github.com/markbates/refresh v1.12.0
github.com/markbates/safe v1.0.1
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/monoculum/formam v3.5.5+incompatible
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.7.1
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
)
22 changes: 5 additions & 17 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand Down Expand Up @@ -313,8 +312,6 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw=
github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
Expand All @@ -341,18 +338,15 @@ github.com/luna-duclos/instrumentedsql v1.1.3/go.mod h1:9J1njvFds+zN7y85EDhN9XNQ
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/markbates/grift v1.5.0 h1:CZyK0k+8BdhQMgbwzuKMysC12y4tf9H004jAs/FutX4=
github.com/markbates/grift v1.5.0/go.mod h1:1ssFm5gSGmzTkhi3Wfh/nqlU74J73TlAjoDMttQbpfY=
github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY=
github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI=
github.com/markbates/refresh v1.12.0 h1:vTgVPX4p77v26auBJhlgaTQ/adWAYSIcVYJvM63Nbpo=
github.com/markbates/refresh v1.12.0/go.mod h1:Vpwi1+q+2U1VxE7C0Ilj6r2/+TigRzQcLez6XM3bPLc=
github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI=
github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
Expand Down Expand Up @@ -485,9 +479,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -641,10 +634,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d h1:FjkYO/PPp4Wi0EAUOVLxePm7qVW4r4ctbWpURyuOD0E=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
Expand All @@ -656,9 +647,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -827,8 +817,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
Expand Down
2 changes: 1 addition & 1 deletion home.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
could be strage.
*/

// Home is a container for Domains and Groups that independantly serves a
// Home is a container for Domains and Groups that independently serves a
// group of pages with its own Middleware and ErrorHandlers. It is usually
// a multi-homed server domain or group of paths under a certain prefix.
//
Expand Down
3 changes: 0 additions & 3 deletions mail/internal/mail/mime.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.5
// +build go1.5

package mail

import (
Expand Down
25 changes: 0 additions & 25 deletions mail/internal/mail/mime_go14.go

This file was deleted.

13 changes: 1 addition & 12 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/gobuffalo/pop/v6"
"github.com/gobuffalo/pop/v6/logging"
"github.com/gorilla/sessions"
"github.com/markbates/oncer"
)

// Options are used to configure and define how your application should run.
Expand All @@ -29,9 +28,7 @@ type Options struct {
// Env is the "environment" in which the App is running. Default is "development".
Env string `json:"env"`

// LogLevel defaults to "debug". Deprecated use LogLvl instead
LogLevel string `json:"log_level"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecated 4 years ago and now dropped! congratulations, but I think the release note should have a comment on this dropping.

// LogLevl defaults to logger.DebugLvl.
// LogLvl defaults to logger.DebugLvl.
LogLvl logger.Level `json:"log_lvl"`
// Logger to be used with the application. A default one is provided.
Logger Logger `json:"-"`
Expand Down Expand Up @@ -125,14 +122,6 @@ func optionsWithDefaults(opts Options) Options {
}
}

if len(opts.LogLevel) > 0 {
var err error
oncer.Deprecate(0, "github.com/gobuffalo/buffalo#Options.LogLevel", "Use github.com/gobuffalo/buffalo#Options.LogLvl instead.")
opts.LogLvl, err = logger.ParseLevel(opts.LogLevel)
if err != nil {
opts.LogLvl = logger.DebugLevel
}
}
if opts.LogLvl == 0 {
opts.LogLvl = logger.DebugLevel
}
Expand Down
42 changes: 19 additions & 23 deletions plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import (
"os"
"os/exec"
"strings"
"sync"

"github.com/gobuffalo/buffalo/plugins"
"github.com/gobuffalo/envy"
"github.com/gobuffalo/events"
"github.com/markbates/oncer"
"github.com/markbates/safe"
)

var loadPlugins sync.Once

// LoadPlugins will add listeners for any plugins that support "events"
func LoadPlugins() error {
var errResult error
oncer.Do("events.LoadPlugins", func() {
loadPlugins.Do(func() {
// don't send plugins events during testing
if envy.Get("GO_ENV", "development") == "test" {
return
Expand All @@ -33,28 +34,23 @@ func LoadPlugins() error {
continue
}
err := func(c plugins.Command) error {
return safe.RunE(func() error {
n := fmt.Sprintf("[PLUGIN] %s %s", c.Binary, c.Name)
fn := func(e events.Event) {
b, err := json.Marshal(e)
if err != nil {
fmt.Println("error trying to marshal event", e, err)
return
}
cmd := exec.Command(c.Binary, c.UseCommand, string(b))
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
if err := cmd.Run(); err != nil {
fmt.Println("error trying to send event", strings.Join(cmd.Args, " "), err)
}
}
_, err := events.NamedListen(n, events.Filter(c.ListenFor, fn))
n := fmt.Sprintf("[PLUGIN] %s %s", c.Binary, c.Name)
fn := func(e events.Event) {
b, err := json.Marshal(e)
if err != nil {
return err
fmt.Println("error trying to marshal event", e, err)
return
}
cmd := exec.Command(c.Binary, c.UseCommand, string(b))
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
if err := cmd.Run(); err != nil {
fmt.Println("error trying to send event", strings.Join(cmd.Args, " "), err)
}
return nil
})
}
_, err := events.NamedListen(n, events.Filter(c.ListenFor, fn))
return err
}(c)
if err != nil {
errResult = err
Expand Down
2 changes: 1 addition & 1 deletion plugins/log.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//+build !debug
// +build !debug

package plugins

Expand Down
2 changes: 1 addition & 1 deletion plugins/log_debug.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//+build debug
// +build debug

package plugins

Expand Down
34 changes: 16 additions & 18 deletions plugins/plugdeps/plugdeps.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ package plugdeps

import (
"fmt"
"io/fs"
"os"
"path/filepath"
"strings"

"github.com/gobuffalo/meta"
"github.com/karrick/godirwalk"
)

// ErrMissingConfig is if config/buffalo-plugins.toml file is not found. Use plugdeps#On(app) to test if plugdeps are being used
var ErrMissingConfig = fmt.Errorf("could not find a buffalo-plugins config file at %s", ConfigPath(meta.New(".")))

// List all of the plugins the application depeneds on. Will return ErrMissingConfig
// List all of the plugins the application depends on. Will return ErrMissingConfig
// if the app is not using config/buffalo-plugins.toml to manage their plugins.
// Use plugdeps#On(app) to test if plugdeps are being used.
func List(app meta.App) (*Plugins, error) {
Expand Down Expand Up @@ -46,25 +46,23 @@ func List(app meta.App) (*Plugins, error) {

func listLocal(app meta.App) (*Plugins, error) {
plugs := New()
proot := filepath.Join(app.Root, "plugins")
if _, err := os.Stat(proot); err != nil {
pRoot := filepath.Join(app.Root, "plugins")
if _, err := os.Stat(pRoot); err != nil {
return plugs, nil
}
err := godirwalk.Walk(proot, &godirwalk.Options{
FollowSymbolicLinks: true,
Callback: func(path string, info *godirwalk.Dirent) error {
if info.IsDir() {
return nil
}
base := filepath.Base(path)
if strings.HasPrefix(base, "buffalo-") {
plugs.Add(Plugin{
Binary: base,
Local: "." + strings.TrimPrefix(path, app.Root),
})
}
err := filepath.WalkDir(pRoot, func(path string, d fs.DirEntry, err error) error {
if d.IsDir() {
return nil
},
}
if !strings.HasPrefix(d.Name(), "buffalo-") {
return nil
}

plugs.Add(Plugin{
Binary: d.Name(),
Local: "." + strings.TrimPrefix(path, app.Root),
})
return nil
})
if err != nil {
return plugs, err
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugdeps/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (plugs *Plugins) Decode(r io.Reader) error {
tp := &tomlPlugins{
Plugins: []Plugin{},
}
if _, err := toml.DecodeReader(r, tp); err != nil {
if _, err := toml.NewDecoder(r).Decode(tp); err != nil {
return err
}
for _, p := range tp.Plugins {
Expand Down
Loading