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"
"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"
)
@ -32,12 +32,12 @@ var Command = cli.Command{
cli.StringFlag{
Name: "event",
Usage: "event filter",
Value: drone.EventPush,
Value: woodpecker.EventPush,
},
cli.StringFlag{
Name: "status",
Usage: "status filter",
Value: drone.StatusSuccess,
Value: woodpecker.StatusSuccess,
},
cli.StringSliceFlag{
Name: "param, p",

View file

@ -11,11 +11,11 @@ import (
"golang.org/x/net/proxy"
"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.
func NewClient(c *cli.Context) (drone.Client, error) {
func NewClient(c *cli.Context) (woodpecker.Client, error) {
var (
skip = c.GlobalBool("skip-verify")
socks = c.GlobalString("socks-proxy")
@ -26,12 +26,12 @@ func NewClient(c *cli.Context) (drone.Client, error) {
server = strings.TrimRight(server, "/")
// if no server url is provided we can default
// to the hosted Drone service.
// to the hosted Woodpecker service.
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 {
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
@ -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.

View file

@ -5,7 +5,7 @@ import (
"strings"
"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"
)
@ -54,7 +54,7 @@ func registryCreate(c *cli.Context) error {
if err != nil {
return err
}
registry := &drone.Registry{
registry := &woodpecker.Registry{
Address: hostname,
Username: username,
Password: password,

View file

@ -5,7 +5,7 @@ import (
"strings"
"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"
)
@ -54,7 +54,7 @@ func registryUpdate(c *cli.Context) error {
if err != nil {
return err
}
registry := &drone.Registry{
registry := &woodpecker.Registry{
Address: hostname,
Username: username,
Password: password,

View file

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

View file

@ -5,7 +5,7 @@ import (
"strings"
"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"
)
@ -52,7 +52,7 @@ func secretCreate(c *cli.Context) error {
if err != nil {
return err
}
secret := &drone.Secret{
secret := &woodpecker.Secret{
Name: c.String("name"),
Value: c.String("value"),
Images: c.StringSlice("image"),
@ -74,7 +74,7 @@ func secretCreate(c *cli.Context) error {
}
var defaultSecretEvents = []string{
drone.EventPush,
drone.EventTag,
drone.EventDeploy,
woodpecker.EventPush,
woodpecker.EventTag,
woodpecker.EventDeploy,
}

View file

@ -5,7 +5,7 @@ import (
"strings"
"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"
)
@ -52,7 +52,7 @@ func secretUpdate(c *cli.Context) error {
if err != nil {
return err
}
secret := &drone.Secret{
secret := &woodpecker.Secret{
Name: c.String("name"),
Value: c.String("value"),
Images: c.StringSlice("image"),

View file

@ -4,7 +4,7 @@ import (
"fmt"
"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"
)
@ -24,7 +24,7 @@ func userAdd(c *cli.Context) error {
return err
}
user, err := client.UserPost(&drone.User{Login: login})
user, err := client.UserPost(&woodpecker.User{Login: login})
if err != nil {
return err
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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