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"
log "github.com/Sirupsen/logrus"
"github.com/drone/drone/common"
common "github.com/drone/drone/pkg/types"
"github.com/samalba/dockerclient"
)

View file

@ -5,7 +5,7 @@ import (
"fmt"
"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/inject"
"github.com/samalba/dockerclient"

View file

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

View file

@ -5,7 +5,7 @@ import (
"strconv"
"time"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/types"
)
type CCProjects struct {
@ -23,10 +23,10 @@ type CCProject struct {
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{
Name: r.Owner + "/" + r.Name,
WebURL: url,
WebURL: r.Self,
Activity: "Building",
LastBuildStatus: "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
// we can return the latest build status.
if c.State != common.StatePending &&
c.State != common.StateRunning {
if c.State != types.StatePending &&
c.State != types.StateRunning {
proj.Activity = "Sleeping"
proj.LastBuildTime = time.Unix(c.Started, 0).Format(time.RFC3339)
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
// ccmenu enumeration
switch c.State {
case common.StateError, common.StateKilled:
case types.StateError, types.StateKilled:
proj.LastBuildStatus = "Exception"
case common.StateSuccess:
case types.StateSuccess:
proj.LastBuildStatus = "Success"
case common.StateFailure:
case types.StateFailure:
proj.LastBuildStatus = "Failure"
default:
proj.LastBuildStatus = "Unknown"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ import (
"sort"
"strings"
"github.com/drone/drone/common"
"github.com/drone/drone/pkg/types"
"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.
func parse(raw string) (*common.Config, error) {
cfg := common.Config{}
func parse(raw string) (*types.Config, error) {
cfg := types.Config{}
err := yaml.Unmarshal([]byte(raw), &cfg)
return &cfg, err
}

View file

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

View file

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

View file

@ -1,7 +1,7 @@
package parser
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/matrix"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,8 +4,8 @@ import (
"strings"
log "github.com/Sirupsen/logrus"
"github.com/drone/drone/common"
"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/inject"
"github.com/drone/drone/pkg/yaml/matrix"

View file

@ -9,9 +9,9 @@ import (
"github.com/ungerik/go-gravatar"
log "github.com/Sirupsen/logrus"
"github.com/drone/drone/common"
"github.com/drone/drone/common/httputil"
"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

View file

@ -6,10 +6,10 @@ import (
"github.com/gin-gonic/gin"
"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"
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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@ import (
"github.com/gin-gonic/gin/binding"
"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