0
0
mirror of https://github.com/thegeeklab/wp-s3-action.git synced 2024-11-21 04:40:39 +00:00

chore: migrate to wp-plugin-go v3 (#118)

This commit is contained in:
Robert Kaussow 2024-05-18 10:01:22 +02:00 committed by GitHub
parent ff97059f7f
commit e14a5011da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 19 deletions

2
go.mod
View File

@ -10,7 +10,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.2 github.com/aws/aws-sdk-go-v2/service/s3 v1.53.2
github.com/rs/zerolog v1.32.0 github.com/rs/zerolog v1.32.0
github.com/stretchr/testify v1.9.0 github.com/stretchr/testify v1.9.0
github.com/thegeeklab/wp-plugin-go/v2 v2.3.1 github.com/thegeeklab/wp-plugin-go/v3 v3.0.2
github.com/urfave/cli/v2 v2.27.2 github.com/urfave/cli/v2 v2.27.2
) )

4
go.sum
View File

@ -90,8 +90,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/thegeeklab/wp-plugin-go/v2 v2.3.1 h1:ARwYgTPZ5iPsmOenmqcCf8TjiEe8wBOHKO7H/Xshe48= github.com/thegeeklab/wp-plugin-go/v3 v3.0.2 h1:Mv5i8S1WY+BUNjTjX6lOnB3p8S9mvM+XwfY4R98gx0g=
github.com/thegeeklab/wp-plugin-go/v2 v2.3.1/go.mod h1:0t8M8txtEFiaB6RqLX8vLrxkqAo5FT5Hx7dztN592D4= github.com/thegeeklab/wp-plugin-go/v3 v3.0.2/go.mod h1:ij1iJcAVgzerBTqXnmq0bu1VA+hhVVwzXKqiqfoGjjg=
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI= github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM= github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw= github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=

View File

@ -10,8 +10,8 @@ import (
"os" "os"
"time" "time"
"github.com/thegeeklab/wp-plugin-go/v2/docs" plugin_docs "github.com/thegeeklab/wp-plugin-go/v3/docs"
"github.com/thegeeklab/wp-plugin-go/v2/template" plugin_template "github.com/thegeeklab/wp-plugin-go/v3/template"
"github.com/thegeeklab/wp-s3-action/plugin" "github.com/thegeeklab/wp-s3-action/plugin"
) )
@ -23,7 +23,7 @@ func main() {
p := plugin.New(nil) p := plugin.New(nil)
out, err := template.Render(context.Background(), client, tmpl, docs.GetTemplateData(p.App)) out, err := plugin_template.Render(context.Background(), client, tmpl, plugin_docs.GetTemplateData(p.App))
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -3,8 +3,8 @@ package plugin
import ( import (
"fmt" "fmt"
wp "github.com/thegeeklab/wp-plugin-go/v2/plugin" plugin_base "github.com/thegeeklab/wp-plugin-go/v3/plugin"
"github.com/thegeeklab/wp-plugin-go/v2/types" plugin_types "github.com/thegeeklab/wp-plugin-go/v3/types"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@ -12,7 +12,7 @@ import (
// Plugin implements provide the plugin implementation. // Plugin implements provide the plugin implementation.
type Plugin struct { type Plugin struct {
*wp.Plugin *plugin_base.Plugin
Settings *Settings Settings *Settings
} }
@ -50,15 +50,15 @@ type Result struct {
err error err error
} }
func New(e wp.ExecuteFunc, build ...string) *Plugin { func New(e plugin_base.ExecuteFunc, build ...string) *Plugin {
p := &Plugin{ p := &Plugin{
Settings: &Settings{}, Settings: &Settings{},
} }
options := wp.Options{ options := plugin_base.Options{
Name: "wp-s3-action", Name: "wp-s3-action",
Description: "Perform S3 actions", Description: "Perform S3 actions",
Flags: Flags(p.Settings, wp.FlagsPluginCategory), Flags: Flags(p.Settings, plugin_base.FlagsPluginCategory),
Execute: p.run, Execute: p.run,
HideWoodpeckerFlags: true, HideWoodpeckerFlags: true,
} }
@ -75,7 +75,7 @@ func New(e wp.ExecuteFunc, build ...string) *Plugin {
options.Execute = e options.Execute = e
} }
p.Plugin = wp.New(options) p.Plugin = plugin_base.New(options)
return p return p
} }
@ -156,42 +156,42 @@ func Flags(settings *Settings, category string) []cli.Flag {
Name: "acl", Name: "acl",
Usage: "access control list", Usage: "access control list",
EnvVars: []string{"PLUGIN_ACL"}, EnvVars: []string{"PLUGIN_ACL"},
Value: &types.StringMapFlag{}, Value: &plugin_types.StringMapFlag{},
Category: category, Category: category,
}, },
&cli.GenericFlag{ &cli.GenericFlag{
Name: "content-type", Name: "content-type",
Usage: "content-type settings for uploads", Usage: "content-type settings for uploads",
EnvVars: []string{"PLUGIN_CONTENT_TYPE"}, EnvVars: []string{"PLUGIN_CONTENT_TYPE"},
Value: &types.StringMapFlag{}, Value: &plugin_types.StringMapFlag{},
Category: category, Category: category,
}, },
&cli.GenericFlag{ &cli.GenericFlag{
Name: "content-encoding", Name: "content-encoding",
Usage: "content-encoding settings for uploads", Usage: "content-encoding settings for uploads",
EnvVars: []string{"PLUGIN_CONTENT_ENCODING"}, EnvVars: []string{"PLUGIN_CONTENT_ENCODING"},
Value: &types.StringMapFlag{}, Value: &plugin_types.StringMapFlag{},
Category: category, Category: category,
}, },
&cli.GenericFlag{ &cli.GenericFlag{
Name: "cache-control", Name: "cache-control",
Usage: "cache-control settings for uploads", Usage: "cache-control settings for uploads",
EnvVars: []string{"PLUGIN_CACHE_CONTROL"}, EnvVars: []string{"PLUGIN_CACHE_CONTROL"},
Value: &types.StringMapFlag{}, Value: &plugin_types.StringMapFlag{},
Category: category, Category: category,
}, },
&cli.GenericFlag{ &cli.GenericFlag{
Name: "metadata", Name: "metadata",
Usage: "additional metadata for uploads", Usage: "additional metadata for uploads",
EnvVars: []string{"PLUGIN_METADATA"}, EnvVars: []string{"PLUGIN_METADATA"},
Value: &types.DeepStringMapFlag{}, Value: &plugin_types.DeepStringMapFlag{},
Category: category, Category: category,
}, },
&cli.GenericFlag{ &cli.GenericFlag{
Name: "redirects", Name: "redirects",
Usage: "redirects to create", Usage: "redirects to create",
EnvVars: []string{"PLUGIN_REDIRECTS"}, EnvVars: []string{"PLUGIN_REDIRECTS"},
Value: &types.MapFlag{}, Value: &plugin_types.MapFlag{},
Category: category, Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{