Rename drone-go (#390)

This commit is contained in:
Anbraten 2021-10-03 00:27:43 +02:00 committed by GitHub
parent bb37836600
commit 2f267e2a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 36 additions and 36 deletions

View file

@ -7,7 +7,7 @@ import (
"strconv" "strconv"
"github.com/woodpecker-ci/woodpecker/cli/internal" "github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -32,12 +32,12 @@ var Command = cli.Command{
cli.StringFlag{ cli.StringFlag{
Name: "event", Name: "event",
Usage: "event filter", Usage: "event filter",
Value: drone.EventPush, Value: woodpecker.EventPush,
}, },
cli.StringFlag{ cli.StringFlag{
Name: "status", Name: "status",
Usage: "status filter", Usage: "status filter",
Value: drone.StatusSuccess, Value: woodpecker.StatusSuccess,
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
Name: "param, p", Name: "param, p",

View file

@ -11,11 +11,11 @@ import (
"golang.org/x/net/proxy" "golang.org/x/net/proxy"
"golang.org/x/oauth2" "golang.org/x/oauth2"
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
) )
// NewClient returns a new client from the CLI context. // NewClient returns a new client from the CLI context.
func NewClient(c *cli.Context) (drone.Client, error) { func NewClient(c *cli.Context) (woodpecker.Client, error) {
var ( var (
skip = c.GlobalBool("skip-verify") skip = c.GlobalBool("skip-verify")
socks = c.GlobalString("socks-proxy") socks = c.GlobalString("socks-proxy")
@ -26,12 +26,12 @@ func NewClient(c *cli.Context) (drone.Client, error) {
server = strings.TrimRight(server, "/") server = strings.TrimRight(server, "/")
// if no server url is provided we can default // if no server url is provided we can default
// to the hosted Drone service. // to the hosted Woodpecker service.
if len(server) == 0 { if len(server) == 0 {
return nil, fmt.Errorf("Error: you must provide the Drone server address.") return nil, fmt.Errorf("Error: you must provide the Woodpecker server address.")
} }
if len(token) == 0 { if len(token) == 0 {
return nil, fmt.Errorf("Error: you must provide your Drone access token.") return nil, fmt.Errorf("Error: you must provide your Woodpecker access token.")
} }
// attempt to find system CA certs // attempt to find system CA certs
@ -68,7 +68,7 @@ func NewClient(c *cli.Context) (drone.Client, error) {
} }
} }
return drone.NewClient(server, auther), nil return woodpecker.NewClient(server, auther), nil
} }
// ParseRepo parses the repository owner and name from a string. // ParseRepo parses the repository owner and name from a string.

View file

@ -5,7 +5,7 @@ import (
"strings" "strings"
"github.com/woodpecker-ci/woodpecker/cli/internal" "github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -54,7 +54,7 @@ func registryCreate(c *cli.Context) error {
if err != nil { if err != nil {
return err return err
} }
registry := &drone.Registry{ registry := &woodpecker.Registry{
Address: hostname, Address: hostname,
Username: username, Username: username,
Password: password, Password: password,

View file

@ -5,7 +5,7 @@ import (
"strings" "strings"
"github.com/woodpecker-ci/woodpecker/cli/internal" "github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -54,7 +54,7 @@ func registryUpdate(c *cli.Context) error {
if err != nil { if err != nil {
return err return err
} }
registry := &drone.Registry{ registry := &woodpecker.Registry{
Address: hostname, Address: hostname,
Username: username, Username: username,
Password: password, Password: password,

View file

@ -5,7 +5,7 @@ import (
"time" "time"
"github.com/woodpecker-ci/woodpecker/cli/internal" "github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -34,7 +34,7 @@ var repoUpdateCmd = cli.Command{
}, },
cli.StringFlag{ cli.StringFlag{
Name: "config", Name: "config",
Usage: "repository configuration path (e.g. .drone.yml)", Usage: "repository configuration path (e.g. .woodpecker.yml)",
}, },
cli.IntFlag{ cli.IntFlag{
Name: "build-counter", Name: "build-counter",
@ -69,7 +69,7 @@ func repoUpdate(c *cli.Context) error {
unsafe = c.Bool("unsafe") unsafe = c.Bool("unsafe")
) )
patch := new(drone.RepoPatch) patch := new(woodpecker.RepoPatch)
if c.IsSet("trusted") { if c.IsSet("trusted") {
patch.IsTrusted = &trusted patch.IsTrusted = &trusted
} }

View file

@ -5,7 +5,7 @@ import (
"strings" "strings"
"github.com/woodpecker-ci/woodpecker/cli/internal" "github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -52,7 +52,7 @@ func secretCreate(c *cli.Context) error {
if err != nil { if err != nil {
return err return err
} }
secret := &drone.Secret{ secret := &woodpecker.Secret{
Name: c.String("name"), Name: c.String("name"),
Value: c.String("value"), Value: c.String("value"),
Images: c.StringSlice("image"), Images: c.StringSlice("image"),
@ -74,7 +74,7 @@ func secretCreate(c *cli.Context) error {
} }
var defaultSecretEvents = []string{ var defaultSecretEvents = []string{
drone.EventPush, woodpecker.EventPush,
drone.EventTag, woodpecker.EventTag,
drone.EventDeploy, woodpecker.EventDeploy,
} }

View file

@ -5,7 +5,7 @@ import (
"strings" "strings"
"github.com/woodpecker-ci/woodpecker/cli/internal" "github.com/woodpecker-ci/woodpecker/cli/internal"
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -52,7 +52,7 @@ func secretUpdate(c *cli.Context) error {
if err != nil { if err != nil {
return err return err
} }
secret := &drone.Secret{ secret := &woodpecker.Secret{
Name: c.String("name"), Name: c.String("name"),
Value: c.String("value"), Value: c.String("value"),
Images: c.StringSlice("image"), Images: c.StringSlice("image"),

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"github.com/woodpecker-ci/woodpecker/cli/internal" "github.com/woodpecker-ci/woodpecker/cli/internal"
) )
@ -24,7 +24,7 @@ func userAdd(c *cli.Context) error {
return err return err
} }
user, err := client.UserPost(&drone.User{Login: login}) user, err := client.UserPost(&woodpecker.User{Login: login})
if err != nil { if err != nil {
return err return err
} }

View file

@ -1,14 +1,14 @@
# drone-go # woodpecker-go
```Go ```Go
import ( import (
"github.com/woodpecker-ci/woodpecker/drone-go/drone" "github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )
const ( const (
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9" token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
host = "http://drone.company.com" host = "http://woodpecker.company.tld"
) )
func main() { func main() {
@ -21,15 +21,15 @@ func main() {
}, },
) )
// create the drone client with authenticator // create the woodpecker client with authenticator
client := drone.NewClient(host, auther) client := woodpecker.NewClient(host, auther)
// gets the current user // gets the current user
user, err := client.Self() user, err := client.Self()
fmt.Println(user, err) fmt.Println(user, err)
// gets the named repository information // gets the named repository information
repo, err := client.Repo("drone", "drone-go") repo, err := client.Repo("woodpecker-ci", "woodpecker")
fmt.Println(repo, err) fmt.Println(repo, err)
} }
``` ```

View file

@ -1,4 +1,4 @@
package drone package woodpecker
import ( import (
"bytes" "bytes"

View file

@ -1,4 +1,4 @@
package drone package woodpecker
import ( import (
"fmt" "fmt"

View file

@ -1,4 +1,4 @@
package drone package woodpecker
// Event values. // Event values.
const ( const (

View file

@ -1,4 +1,4 @@
package drone package woodpecker
import "net/http" import "net/http"

View file

@ -1,4 +1,4 @@
package drone package woodpecker
type ( type (
// User represents a user account. // User represents a user account.