fix: rename Gogs to Gitea

This commit is contained in:
Bo-Yi Wu 2017-05-01 21:08:57 +08:00
parent 70072321e9
commit 2263ba2a8d
No known key found for this signature in database
GPG key ID: 0F84B2110C500B1F
5 changed files with 24 additions and 24 deletions

View file

@ -1,6 +1,6 @@
package fixtures
// Sample Gogs push hook
// Sample Gitea push hook
var HookPush = `
{
"ref": "refs/heads/master",
@ -49,7 +49,7 @@ var HookPush = `
}
`
// Sample Gogs tag hook
// Sample Gitea tag hook
var HookPushTag = `{
"secret": "l26Un7G7HXogLAvsyf2hOA4EMARSTsR3",
"ref": "v1.0.0",

View file

@ -34,7 +34,7 @@ type client struct {
const (
DescPending = "the build is pending"
DescRunning = "the buils is running"
DescRunning = "the build is running"
DescSuccess = "the build was successful"
DescFailure = "the build failed"
DescCanceled = "the build canceled"
@ -230,7 +230,7 @@ func (c *client) File(u *model.User, r *model.Repo, b *model.Build, f string) ([
client := c.newClientToken(u.Token)
ref := b.Commit
// TODO gogs does not yet return a sha with the pull request
// TODO gitea does not yet return a sha with the pull request
// so unfortunately we need to use the pull request branch.
if b.Event == model.EventPull {
ref = b.Branch

View file

@ -11,7 +11,7 @@ import (
"github.com/gin-gonic/gin"
)
func Test_gogs(t *testing.T) {
func Test_gitea(t *testing.T) {
gin.SetMode(gin.TestMode)
s := httptest.NewServer(fixtures.Handler())
@ -52,21 +52,21 @@ func Test_gogs(t *testing.T) {
g.Describe("Generating a netrc file", func() {
g.It("Should return a netrc with the user token", func() {
remote, _ := New(Opts{
URL: "http://gogs.com",
URL: "http://gitea.com",
})
netrc, _ := remote.Netrc(fakeUser, nil)
g.Assert(netrc.Machine).Equal("gogs.com")
g.Assert(netrc.Machine).Equal("gitea.com")
g.Assert(netrc.Login).Equal(fakeUser.Token)
g.Assert(netrc.Password).Equal("x-oauth-basic")
})
g.It("Should return a netrc with the machine account", func() {
remote, _ := New(Opts{
URL: "http://gogs.com",
URL: "http://gitea.com",
Username: "someuser",
Password: "password",
})
netrc, _ := remote.Netrc(nil, nil)
g.Assert(netrc.Machine).Equal("gogs.com")
g.Assert(netrc.Machine).Equal("gitea.com")
g.Assert(netrc.Login).Equal("someuser")
g.Assert(netrc.Password).Equal("password")
})

View file

@ -12,7 +12,7 @@ import (
"github.com/go-gitea/go-sdk/gitea"
)
// helper function that converts a Gogs repository to a Drone repository.
// helper function that converts a Gitea repository to a Drone repository.
func toRepoLite(from *gitea.Repository) *model.RepoLite {
name := strings.Split(from.FullName, "/")[1]
avatar := expandAvatar(
@ -27,7 +27,7 @@ func toRepoLite(from *gitea.Repository) *model.RepoLite {
}
}
// helper function that converts a Gogs repository to a Drone repository.
// helper function that converts a Gitea repository to a Drone repository.
func toRepo(from *gitea.Repository) *model.Repo {
name := strings.Split(from.FullName, "/")[1]
avatar := expandAvatar(
@ -47,7 +47,7 @@ func toRepo(from *gitea.Repository) *model.Repo {
}
}
// helper function that converts a Gogs permission to a Drone permission.
// helper function that converts a Gitea permission to a Drone permission.
func toPerm(from *gitea.Permission) *model.Perm {
return &model.Perm{
Pull: from.Pull,
@ -56,7 +56,7 @@ func toPerm(from *gitea.Permission) *model.Perm {
}
}
// helper function that converts a Gogs team to a Drone team.
// helper function that converts a Gitea team to a Drone team.
func toTeam(from *gitea.Organization, link string) *model.Team {
return &model.Team{
Login: from.UserName,
@ -64,7 +64,7 @@ func toTeam(from *gitea.Organization, link string) *model.Team {
}
}
// helper function that extracts the Build data from a Gogs push hook
// helper function that extracts the Build data from a Gitea push hook
func buildFromPush(hook *pushHook) *model.Build {
avatar := expandAvatar(
hook.Repo.URL,
@ -93,7 +93,7 @@ func buildFromPush(hook *pushHook) *model.Build {
}
}
// helper function that extracts the Build data from a Gogs tag hook
// helper function that extracts the Build data from a Gitea tag hook
func buildFromTag(hook *pushHook) *model.Build {
avatar := expandAvatar(
hook.Repo.URL,
@ -122,7 +122,7 @@ func buildFromTag(hook *pushHook) *model.Build {
}
}
// helper function that extracts the Build data from a Gogs pull_request hook
// helper function that extracts the Build data from a Gitea pull_request hook
func buildFromPullRequest(hook *pullRequestHook) *model.Build {
avatar := expandAvatar(
hook.Repo.URL,
@ -151,7 +151,7 @@ func buildFromPullRequest(hook *pullRequestHook) *model.Build {
return build
}
// helper function that extracts the Repository data from a Gogs push hook
// helper function that extracts the Repository data from a Gitea push hook
func repoFromPush(hook *pushHook) *model.Repo {
return &model.Repo{
Name: hook.Repo.Name,
@ -161,7 +161,7 @@ func repoFromPush(hook *pushHook) *model.Repo {
}
}
// helper function that extracts the Repository data from a Gogs pull_request hook
// helper function that extracts the Repository data from a Gitea pull_request hook
func repoFromPullRequest(hook *pullRequestHook) *model.Repo {
return &model.Repo{
Name: hook.Repo.Name,

View file

@ -14,7 +14,7 @@ import (
func Test_parse(t *testing.T) {
g := goblin.Goblin(t)
g.Describe("Gogs", func() {
g.Describe("Gitea", func() {
g.It("Should parse push hook payload", func() {
buf := bytes.NewBufferString(fixtures.HookPush)
@ -143,7 +143,7 @@ func Test_parse(t *testing.T) {
}
})
g.It("Should return a Team struct from a Gogs Org", func() {
g.It("Should return a Team struct from a Gitea Org", func() {
from := &gitea.Organization{
UserName: "drone",
AvatarURL: "/avatars/1",
@ -154,7 +154,7 @@ func Test_parse(t *testing.T) {
g.Assert(to.Avatar).Equal("http://localhost:80/avatars/1")
})
g.It("Should return a Repo struct from a Gogs Repo", func() {
g.It("Should return a Repo struct from a Gitea Repo", func() {
from := gitea.Repository{
FullName: "gophers/hello-world",
Owner: &gitea.User{
@ -176,7 +176,7 @@ func Test_parse(t *testing.T) {
g.Assert(repo.IsPrivate).Equal(from.Private)
})
g.It("Should return a RepoLite struct from a Gogs Repo", func() {
g.It("Should return a RepoLite struct from a Gitea Repo", func() {
from := gitea.Repository{
FullName: "gophers/hello-world",
Owner: &gitea.User{
@ -235,8 +235,8 @@ func Test_parse(t *testing.T) {
"http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87",
},
{
"/gogs/avatars/2",
"http://gitea.io/gogs/avatars/2",
"/gitea/avatars/2",
"http://gitea.io/gitea/avatars/2",
},
}