Skip to content

Commit

Permalink
chore: migrate to wp-plugin-go v3 (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys authored May 17, 2024
1 parent 6485a9b commit 3f5b43c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
code.gitea.io/sdk/gitea v0.18.0
github.com/rs/zerolog v1.32.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
golang.org/x/crypto v0.23.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,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.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
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/v2 v2.3.1/go.mod h1:0t8M8txtEFiaB6RqLX8vLrxkqAo5FT5Hx7dztN592D4=
github.com/thegeeklab/wp-plugin-go/v3 v3.0.2 h1:Mv5i8S1WY+BUNjTjX6lOnB3p8S9mvM+XwfY4R98gx0g=
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/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
Expand Down
6 changes: 3 additions & 3 deletions internal/doc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

"github.com/thegeeklab/wp-gitea-release/plugin"
"github.com/thegeeklab/wp-plugin-go/v2/docs"
"github.com/thegeeklab/wp-plugin-go/v2/template"
plugin_docs "github.com/thegeeklab/wp-plugin-go/v3/docs"
plugin_template "github.com/thegeeklab/wp-plugin-go/v3/template"
)

func main() {
Expand All @@ -23,7 +23,7 @@ func main() {

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 {
panic(err)
}
Expand Down
6 changes: 3 additions & 3 deletions plugin/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/thegeeklab/wp-gitea-release/gitea"
"github.com/thegeeklab/wp-plugin-go/v2/file"
plugin_file "github.com/thegeeklab/wp-plugin-go/v3/file"
)

var (
Expand Down Expand Up @@ -53,13 +53,13 @@ func (p *Plugin) Validate() error {
}

if p.Settings.Note != "" {
if p.Settings.Note, _, err = file.ReadStringOrFile(p.Settings.Note); err != nil {
if p.Settings.Note, _, err = plugin_file.ReadStringOrFile(p.Settings.Note); err != nil {
return fmt.Errorf("error while reading %s: %w", p.Settings.Note, err)
}
}

if p.Settings.Title != "" {
if p.Settings.Title, _, err = file.ReadStringOrFile(p.Settings.Title); err != nil {
if p.Settings.Title, _, err = plugin_file.ReadStringOrFile(p.Settings.Title); err != nil {
return fmt.Errorf("error while reading %s: %w", p.Settings.Title, err)
}
}
Expand Down
12 changes: 6 additions & 6 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import (
"fmt"
"net/url"

wp "github.com/thegeeklab/wp-plugin-go/v2/plugin"
plugin_base "github.com/thegeeklab/wp-plugin-go/v3/plugin"
"github.com/urfave/cli/v2"
)

//go:generate go run ../internal/doc/main.go -output=../docs/data/data-raw.yaml

// Plugin implements provide the plugin.
type Plugin struct {
*wp.Plugin
*plugin_base.Plugin
Settings *Settings
}

Expand All @@ -32,15 +32,15 @@ type Settings struct {
files []string
}

func New(e wp.ExecuteFunc, build ...string) *Plugin {
func New(e plugin_base.ExecuteFunc, build ...string) *Plugin {
p := &Plugin{
Settings: &Settings{},
}

options := wp.Options{
options := plugin_base.Options{
Name: "wp-gitea-release",
Description: "Publish files and artifacts to Gitea releases",
Flags: Flags(p.Settings, wp.FlagsPluginCategory),
Flags: Flags(p.Settings, plugin_base.FlagsPluginCategory),
Execute: p.run,
HideWoodpeckerFlags: true,
}
Expand All @@ -57,7 +57,7 @@ func New(e wp.ExecuteFunc, build ...string) *Plugin {
options.Execute = e
}

p.Plugin = wp.New(options)
p.Plugin = plugin_base.New(options)

return p
}
Expand Down

0 comments on commit 3f5b43c

Please sign in to comment.