1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-01-23 17:53:23 +02:00

moving more data under pkg dir

This commit is contained in:
Brad Rydzewski 2015-05-17 13:51:42 -07:00
parent 12bbbdba75
commit e3f0a39761
63 changed files with 79 additions and 82 deletions

View File

@ -11,7 +11,7 @@ import (
"strings" "strings"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/samalba/dockerclient" "github.com/samalba/dockerclient"
) )

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"path/filepath" "path/filepath"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/yaml" "github.com/drone/drone/pkg/yaml"
"github.com/drone/drone/pkg/yaml/inject" "github.com/drone/drone/pkg/yaml/inject"
"github.com/samalba/dockerclient" "github.com/samalba/dockerclient"

View File

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/samalba/dockerclient" "github.com/samalba/dockerclient"
) )

View File

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/drone/drone/common" "github.com/drone/drone/pkg/types"
) )
type CCProjects struct { type CCProjects struct {
@ -23,10 +23,10 @@ type CCProject struct {
WebURL string `xml:"webUrl,attr"` WebURL string `xml:"webUrl,attr"`
} }
func NewCC(r *common.Repo, c *common.Commit, url string) *CCProjects { func NewCC(r *types.Repo, c *types.Commit) *CCProjects {
proj := &CCProject{ proj := &CCProject{
Name: r.Owner + "/" + r.Name, Name: r.Owner + "/" + r.Name,
WebURL: url, WebURL: r.Self,
Activity: "Building", Activity: "Building",
LastBuildStatus: "Unknown", LastBuildStatus: "Unknown",
LastBuildLabel: "Unknown", LastBuildLabel: "Unknown",
@ -34,8 +34,8 @@ func NewCC(r *common.Repo, c *common.Commit, url string) *CCProjects {
// if the build is not currently running then // if the build is not currently running then
// we can return the latest build status. // we can return the latest build status.
if c.State != common.StatePending && if c.State != types.StatePending &&
c.State != common.StateRunning { c.State != types.StateRunning {
proj.Activity = "Sleeping" proj.Activity = "Sleeping"
proj.LastBuildTime = time.Unix(c.Started, 0).Format(time.RFC3339) proj.LastBuildTime = time.Unix(c.Started, 0).Format(time.RFC3339)
proj.LastBuildLabel = strconv.Itoa(c.Sequence) proj.LastBuildLabel = strconv.Itoa(c.Sequence)
@ -44,11 +44,11 @@ func NewCC(r *common.Repo, c *common.Commit, url string) *CCProjects {
// ensure the last build state accepts a valid // ensure the last build state accepts a valid
// ccmenu enumeration // ccmenu enumeration
switch c.State { switch c.State {
case common.StateError, common.StateKilled: case types.StateError, types.StateKilled:
proj.LastBuildStatus = "Exception" proj.LastBuildStatus = "Exception"
case common.StateSuccess: case types.StateSuccess:
proj.LastBuildStatus = "Success" proj.LastBuildStatus = "Success"
case common.StateFailure: case types.StateFailure:
proj.LastBuildStatus = "Failure" proj.LastBuildStatus = "Failure"
default: default:
proj.LastBuildStatus = "Unknown" proj.LastBuildStatus = "Unknown"

View File

@ -3,7 +3,7 @@ package queue
import ( import (
"io" "io"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
// Work represents an item for work to be // Work represents an item for work to be

View File

@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"net/rpc" "net/rpc"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/settings" "github.com/drone/drone/settings"
) )

View File

@ -9,7 +9,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/settings" "github.com/drone/drone/settings"
"github.com/hashicorp/golang-lru" "github.com/hashicorp/golang-lru"

View File

@ -3,7 +3,7 @@ package remote
import ( import (
"net/http" "net/http"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
type Remote interface { type Remote interface {

View File

@ -3,7 +3,7 @@ package builtin
import ( import (
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/russross/meddler" "github.com/russross/meddler"
) )

View File

@ -1,8 +1,7 @@
package builtin package builtin
import ( import (
//"fmt" common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/common"
"github.com/franela/goblin" "github.com/franela/goblin"
"testing" "testing"
) )

View File

@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/russross/meddler" "github.com/russross/meddler"
) )

View File

@ -3,7 +3,7 @@ package builtin
import ( import (
"testing" "testing"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/franela/goblin" "github.com/franela/goblin"
) )

View File

@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/russross/meddler" "github.com/russross/meddler"
) )

View File

@ -3,7 +3,7 @@ package builtin
import ( import (
"testing" "testing"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/franela/goblin" "github.com/franela/goblin"
) )

View File

@ -1,7 +1,7 @@
package builtin package builtin
import ( import (
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/russross/meddler" "github.com/russross/meddler"
) )

View File

@ -3,7 +3,7 @@ package builtin
import ( import (
"testing" "testing"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/franela/goblin" "github.com/franela/goblin"
) )

View File

@ -1,7 +1,7 @@
package builtin package builtin
import ( import (
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/russross/meddler" "github.com/russross/meddler"
) )

View File

@ -4,7 +4,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/franela/goblin" "github.com/franela/goblin"
) )

View File

@ -3,7 +3,7 @@ package builtin
import ( import (
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/russross/meddler" "github.com/russross/meddler"
) )

View File

@ -3,7 +3,7 @@ package builtin
import ( import (
"testing" "testing"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/franela/goblin" "github.com/franela/goblin"
) )

View File

@ -3,7 +3,7 @@ package mocks
import ( import (
"io" "io"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
) )

View File

@ -3,7 +3,7 @@ package plugin
import ( import (
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
type GetBuildReq struct { type GetBuildReq struct {

View File

@ -3,7 +3,7 @@ package plugin
import ( import (
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
type GetRepoReq struct { type GetRepoReq struct {

View File

@ -1,7 +1,7 @@
package plugin package plugin
import ( import (
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
type GetTaskReq struct { type GetTaskReq struct {

View File

@ -1,7 +1,7 @@
package plugin package plugin
import ( import (
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
type GetTokenReq struct { type GetTokenReq struct {

View File

@ -3,7 +3,7 @@ package plugin
import ( import (
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
type GetUserReq struct { type GetUserReq struct {

View File

@ -3,7 +3,7 @@ package store
import ( import (
"io" "io"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
type Store interface { type Store interface {

View File

@ -1,4 +1,4 @@
package common package types
// Agent represents a worker that has connected // Agent represents a worker that has connected
// to the system in order to perform work // to the system in order to perform work

View File

@ -1,4 +1,4 @@
package common package types
type Build struct { type Build struct {
ID int64 `meddler:"build_id,pk" json:"-"` ID int64 `meddler:"build_id,pk" json:"-"`

View File

@ -1,4 +1,4 @@
package common package types
type Clone struct { type Clone struct {
Origin string `json:"origin"` Origin string `json:"origin"`

View File

@ -1,4 +1,4 @@
package common package types
const ( const (
StatePending = "pending" StatePending = "pending"

View File

@ -1,4 +1,4 @@
package common package types
import ( import (
"path/filepath" "path/filepath"

View File

@ -1,4 +1,4 @@
package common package types
type Hook struct { type Hook struct {
Repo *Repo Repo *Repo

View File

@ -1,4 +1,4 @@
package common package types
type Repo struct { type Repo struct {
ID int64 `meddler:"repo_id,pk" json:"id"` ID int64 `meddler:"repo_id,pk" json:"id"`

View File

@ -1,4 +1,4 @@
package common package types
type Status struct { type Status struct {
ID int64 `meddler:"status_id,pk" json:"-"` ID int64 `meddler:"status_id,pk" json:"-"`

View File

@ -1,4 +1,4 @@
package common package types
type Task struct { type Task struct {
Number int `json:"number"` Number int `json:"number"`

View File

@ -1,4 +1,4 @@
package common package types
type Token struct { type Token struct {
ID int64 `meddler:"token_id,pk" json:"-"` ID int64 `meddler:"token_id,pk" json:"-"`

View File

@ -1,4 +1,4 @@
package common package types
type User struct { type User struct {
ID int64 `meddler:"user_id,pk" json:"-"` ID int64 `meddler:"user_id,pk" json:"-"`

View File

@ -4,7 +4,7 @@ import (
"sort" "sort"
"strings" "strings"
"github.com/drone/drone/common" "github.com/drone/drone/pkg/types"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )
@ -47,8 +47,8 @@ func InjectSafe(raw string, params map[string]string) string {
} }
// helper funtion to parse a yaml configuration file. // helper funtion to parse a yaml configuration file.
func parse(raw string) (*common.Config, error) { func parse(raw string) (*types.Config, error) {
cfg := common.Config{} cfg := types.Config{}
err := yaml.Unmarshal([]byte(raw), &cfg) err := yaml.Unmarshal([]byte(raw), &cfg)
return &cfg, err return &cfg, err
} }

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
// lintRule defines a function that runs lint // lintRule defines a function that runs lint

View File

@ -3,7 +3,7 @@ package parser
import ( import (
"testing" "testing"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/franela/goblin" "github.com/franela/goblin"
) )

View File

@ -1,7 +1,7 @@
package parser package parser
import ( import (
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/yaml/inject" "github.com/drone/drone/pkg/yaml/inject"
"github.com/drone/drone/pkg/yaml/matrix" "github.com/drone/drone/pkg/yaml/matrix"

View File

@ -3,7 +3,7 @@ package parser
import ( import (
"strings" "strings"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
// transformRule applies a check or transformation rule // transformRule applies a check or transformation rule

View File

@ -3,7 +3,7 @@ package parser
import ( import (
"testing" "testing"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/franela/goblin" "github.com/franela/goblin"
) )

View File

@ -9,8 +9,8 @@ import (
"os" "os"
"time" "time"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/queue" "github.com/drone/drone/pkg/queue"
common "github.com/drone/drone/pkg/types"
"github.com/samalba/dockerclient" "github.com/samalba/dockerclient"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"

View File

@ -5,10 +5,10 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/bus" "github.com/drone/drone/pkg/bus"
"github.com/drone/drone/pkg/remote" "github.com/drone/drone/pkg/remote"
"github.com/drone/drone/pkg/store" "github.com/drone/drone/pkg/store"
common "github.com/drone/drone/pkg/types"
) )
type Updater interface { type Updater interface {

View File

@ -6,7 +6,7 @@ import (
"io/ioutil" "io/ioutil"
"time" "time"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/samalba/dockerclient" "github.com/samalba/dockerclient"
) )

View File

@ -3,8 +3,8 @@ package runner
import ( import (
"io" "io"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/queue" "github.com/drone/drone/pkg/queue"
common "github.com/drone/drone/pkg/types"
) )
type Runner interface { type Runner interface {

View File

@ -1,15 +1,15 @@
package server package server
import ( import (
"github.com/drone/drone/common" "github.com/drone/drone/pkg/types"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// GET /api/agents/token // GET /api/agents/token
func GetAgentToken(c *gin.Context) { func GetAgentToken(c *gin.Context) {
sess := ToSession(c) sess := ToSession(c)
token := &common.Token{} token := &types.Token{}
token.Kind = common.TokenAgent token.Kind = types.TokenAgent
token.Label = "drone-agent" token.Label = "drone-agent"
tokenstr, err := sess.GenerateToken(token) tokenstr, err := sess.GenerateToken(token)
if err != nil { if err != nil {

View File

@ -3,9 +3,8 @@ package server
import ( import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/drone/drone/common" "github.com/drone/drone/pkg/ccmenu"
"github.com/drone/drone/common/ccmenu" common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/common/httputil"
) )
var ( var (
@ -73,8 +72,7 @@ func GetCC(c *gin.Context) {
return return
} }
link := httputil.GetURL(c.Request) + "/" + repo.FullName cc := ccmenu.NewCC(repo, list[0])
cc := ccmenu.NewCC(repo, list[0], link)
c.Writer.Header().Set("Content-Type", "application/xml") c.Writer.Header().Set("Content-Type", "application/xml")
c.XML(200, cc) c.XML(200, cc)

View File

@ -7,9 +7,9 @@ import (
"net/url" "net/url"
"testing" "testing"
"github.com/drone/drone/common" "github.com/drone/drone/pkg/ccmenu"
"github.com/drone/drone/common/ccmenu"
"github.com/drone/drone/pkg/store/mock" "github.com/drone/drone/pkg/store/mock"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/server/recorder" "github.com/drone/drone/server/recorder"
. "github.com/franela/goblin" . "github.com/franela/goblin"

View File

@ -6,8 +6,8 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/queue" "github.com/drone/drone/pkg/queue"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/yaml/inject" "github.com/drone/drone/pkg/yaml/inject"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
// "github.com/gin-gonic/gin/binding" // "github.com/gin-gonic/gin/binding"

View File

@ -4,8 +4,8 @@ import (
"strings" "strings"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/queue" "github.com/drone/drone/pkg/queue"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/yaml" "github.com/drone/drone/pkg/yaml"
"github.com/drone/drone/pkg/yaml/inject" "github.com/drone/drone/pkg/yaml/inject"
"github.com/drone/drone/pkg/yaml/matrix" "github.com/drone/drone/pkg/yaml/matrix"

View File

@ -9,9 +9,9 @@ import (
"github.com/ungerik/go-gravatar" "github.com/ungerik/go-gravatar"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
"github.com/drone/drone/common"
"github.com/drone/drone/common/httputil"
"github.com/drone/drone/common/oauth2" "github.com/drone/drone/common/oauth2"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/utils/httputil"
) )
// GetLogin accepts a request to authorize the user and to // GetLogin accepts a request to authorize the user and to

View File

@ -6,10 +6,10 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
"github.com/drone/drone/common"
"github.com/drone/drone/common/httputil"
"github.com/drone/drone/common/sshutil"
"github.com/drone/drone/pkg/remote" "github.com/drone/drone/pkg/remote"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/pkg/utils/httputil"
"github.com/drone/drone/pkg/utils/sshutil"
) )
// repoResp is a data structure used for sending // repoResp is a data structure used for sending

View File

@ -6,11 +6,11 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/bus" "github.com/drone/drone/pkg/bus"
"github.com/drone/drone/pkg/queue" "github.com/drone/drone/pkg/queue"
"github.com/drone/drone/pkg/remote" "github.com/drone/drone/pkg/remote"
"github.com/drone/drone/pkg/store" "github.com/drone/drone/pkg/store"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/runner" "github.com/drone/drone/runner"
"github.com/drone/drone/server/session" "github.com/drone/drone/server/session"
"github.com/drone/drone/settings" "github.com/drone/drone/settings"

View File

@ -6,7 +6,7 @@ import (
"time" "time"
"github.com/dgrijalva/jwt-go" "github.com/dgrijalva/jwt-go"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/settings" "github.com/drone/drone/settings"
) )

View File

@ -6,7 +6,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
// POST /api/user/tokens // POST /api/user/tokens

View File

@ -5,7 +5,7 @@ import (
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
"github.com/ungerik/go-gravatar" "github.com/ungerik/go-gravatar"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
// GetUserCurr accepts a request to retrieve the // GetUserCurr accepts a request to retrieve the

View File

@ -8,15 +8,15 @@ import (
"net/http" "net/http"
"testing" "testing"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/store/mock" "github.com/drone/drone/pkg/store/mock"
common "github.com/drone/drone/pkg/types"
"github.com/drone/drone/server/recorder" "github.com/drone/drone/server/recorder"
. "github.com/franela/goblin" . "github.com/franela/goblin"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
func TestUser(t *testing.T) { func TestUser(t *testing.T) {
store := new(mocks.Datastore) store := new(mocks.Store)
g := Goblin(t) g := Goblin(t)
g.Describe("User", func() { g.Describe("User", func() {

View File

@ -5,7 +5,7 @@ import (
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
"github.com/ungerik/go-gravatar" "github.com/ungerik/go-gravatar"
"github.com/drone/drone/common" common "github.com/drone/drone/pkg/types"
) )
// GetUsers accepts a request to retrieve all users // GetUsers accepts a request to retrieve all users