From e3f0a397612867491ff8abcfcc9fe8ee0ef1dc55 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Sun, 17 May 2015 13:51:42 -0700 Subject: [PATCH] moving more data under pkg dir --- cmd/drone-build/main.go | 2 +- cmd/drone-build/run.go | 2 +- cmd/drone-build/util.go | 2 +- {common => pkg}/ccmenu/ccmenu.go | 16 ++++++++-------- pkg/queue/worker.go | 2 +- pkg/remote/client/client.go | 2 +- pkg/remote/github/github.go | 2 +- pkg/remote/remote.go | 2 +- pkg/store/builtin/build.go | 2 +- pkg/store/builtin/build_test.go | 3 +-- pkg/store/builtin/commit.go | 2 +- pkg/store/builtin/commit_test.go | 2 +- pkg/store/builtin/repo.go | 2 +- pkg/store/builtin/repo_test.go | 2 +- pkg/store/builtin/star.go | 2 +- pkg/store/builtin/star_test.go | 2 +- pkg/store/builtin/token.go | 2 +- pkg/store/builtin/token_test.go | 2 +- pkg/store/builtin/user.go | 2 +- pkg/store/builtin/users_test.go | 2 +- pkg/store/mock/mock.go | 2 +- pkg/store/plugin/build.go | 2 +- pkg/store/plugin/repo.go | 2 +- pkg/store/plugin/task.go | 2 +- pkg/store/plugin/token.go | 2 +- pkg/store/plugin/user.go | 2 +- pkg/store/store.go | 2 +- {common => pkg/types}/agent.go | 2 +- {common => pkg/types}/build.go | 2 +- {common => pkg/types}/clone.go | 2 +- {common => pkg/types}/commit.go | 2 +- {common => pkg/types}/config.go | 2 +- {common => pkg/types}/hook.go | 2 +- {common => pkg/types}/repo.go | 2 +- {common => pkg/types}/status.go | 2 +- {common => pkg/types}/task.go | 2 +- {common => pkg/types}/token.go | 2 +- {common => pkg/types}/user.go | 2 +- {common => pkg/utils}/httputil/httputil.go | 0 {common => pkg/utils}/sshutil/sshutil.go | 0 pkg/yaml/inject/inject.go | 6 +++--- pkg/yaml/lint.go | 2 +- pkg/yaml/lint_test.go | 2 +- pkg/yaml/parse.go | 2 +- pkg/yaml/trans.go | 2 +- pkg/yaml/trans_test.go | 2 +- runner/builtin/runner.go | 2 +- runner/builtin/updater.go | 2 +- runner/builtin/worker.go | 2 +- runner/runner.go | 2 +- server/agent.go | 6 +++--- server/badge.go | 8 +++----- server/badge_test.go | 4 ++-- server/commits.go | 2 +- server/hooks.go | 2 +- server/login.go | 4 ++-- server/repos.go | 6 +++--- server/server.go | 2 +- server/session/session.go | 2 +- server/token.go | 2 +- server/user.go | 2 +- server/user_test.go | 4 ++-- server/users.go | 2 +- 63 files changed, 79 insertions(+), 82 deletions(-) rename {common => pkg}/ccmenu/ccmenu.go (80%) rename {common => pkg/types}/agent.go (93%) rename {common => pkg/types}/build.go (98%) rename {common => pkg/types}/clone.go (97%) rename {common => pkg/types}/commit.go (99%) rename {common => pkg/types}/config.go (99%) rename {common => pkg/types}/hook.go (77%) rename {common => pkg/types}/repo.go (99%) rename {common => pkg/types}/status.go (96%) rename {common => pkg/types}/task.go (96%) rename {common => pkg/types}/token.go (97%) rename {common => pkg/types}/user.go (97%) rename {common => pkg/utils}/httputil/httputil.go (100%) rename {common => pkg/utils}/sshutil/sshutil.go (100%) diff --git a/cmd/drone-build/main.go b/cmd/drone-build/main.go index 941bf50ad..bc1f25204 100644 --- a/cmd/drone-build/main.go +++ b/cmd/drone-build/main.go @@ -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" ) diff --git a/cmd/drone-build/run.go b/cmd/drone-build/run.go index e275e7fa4..134f9b517 100644 --- a/cmd/drone-build/run.go +++ b/cmd/drone-build/run.go @@ -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" diff --git a/cmd/drone-build/util.go b/cmd/drone-build/util.go index ec77f3179..adb1ebef4 100644 --- a/cmd/drone-build/util.go +++ b/cmd/drone-build/util.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/samalba/dockerclient" ) diff --git a/common/ccmenu/ccmenu.go b/pkg/ccmenu/ccmenu.go similarity index 80% rename from common/ccmenu/ccmenu.go rename to pkg/ccmenu/ccmenu.go index 5b9148dc0..aa830b84a 100644 --- a/common/ccmenu/ccmenu.go +++ b/pkg/ccmenu/ccmenu.go @@ -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" diff --git a/pkg/queue/worker.go b/pkg/queue/worker.go index b7acfad8e..997bb1b68 100644 --- a/pkg/queue/worker.go +++ b/pkg/queue/worker.go @@ -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 diff --git a/pkg/remote/client/client.go b/pkg/remote/client/client.go index 8dbe59a83..55872cb21 100644 --- a/pkg/remote/client/client.go +++ b/pkg/remote/client/client.go @@ -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" ) diff --git a/pkg/remote/github/github.go b/pkg/remote/github/github.go index 7c886dd61..4cf5b4b53 100644 --- a/pkg/remote/github/github.go +++ b/pkg/remote/github/github.go @@ -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" diff --git a/pkg/remote/remote.go b/pkg/remote/remote.go index da2bb27b4..7d3bdf698 100644 --- a/pkg/remote/remote.go +++ b/pkg/remote/remote.go @@ -3,7 +3,7 @@ package remote import ( "net/http" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" ) type Remote interface { diff --git a/pkg/store/builtin/build.go b/pkg/store/builtin/build.go index 21d522499..6792b7e8d 100644 --- a/pkg/store/builtin/build.go +++ b/pkg/store/builtin/build.go @@ -3,7 +3,7 @@ package builtin import ( "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/russross/meddler" ) diff --git a/pkg/store/builtin/build_test.go b/pkg/store/builtin/build_test.go index 9aec6cef3..5b3f9e4d3 100644 --- a/pkg/store/builtin/build_test.go +++ b/pkg/store/builtin/build_test.go @@ -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" ) diff --git a/pkg/store/builtin/commit.go b/pkg/store/builtin/commit.go index 9ffeccff7..87e7b72fb 100644 --- a/pkg/store/builtin/commit.go +++ b/pkg/store/builtin/commit.go @@ -4,7 +4,7 @@ import ( "database/sql" "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/russross/meddler" ) diff --git a/pkg/store/builtin/commit_test.go b/pkg/store/builtin/commit_test.go index 2a49d790f..b7854eecb 100644 --- a/pkg/store/builtin/commit_test.go +++ b/pkg/store/builtin/commit_test.go @@ -3,7 +3,7 @@ package builtin import ( "testing" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/franela/goblin" ) diff --git a/pkg/store/builtin/repo.go b/pkg/store/builtin/repo.go index 14a3cd18b..dc4090f92 100644 --- a/pkg/store/builtin/repo.go +++ b/pkg/store/builtin/repo.go @@ -4,7 +4,7 @@ import ( "database/sql" "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/russross/meddler" ) diff --git a/pkg/store/builtin/repo_test.go b/pkg/store/builtin/repo_test.go index 1be077248..e58105cb1 100644 --- a/pkg/store/builtin/repo_test.go +++ b/pkg/store/builtin/repo_test.go @@ -3,7 +3,7 @@ package builtin import ( "testing" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/franela/goblin" ) diff --git a/pkg/store/builtin/star.go b/pkg/store/builtin/star.go index d015abd51..bfe35acfe 100644 --- a/pkg/store/builtin/star.go +++ b/pkg/store/builtin/star.go @@ -1,7 +1,7 @@ package builtin import ( - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/russross/meddler" ) diff --git a/pkg/store/builtin/star_test.go b/pkg/store/builtin/star_test.go index dbc8b571d..274b62927 100644 --- a/pkg/store/builtin/star_test.go +++ b/pkg/store/builtin/star_test.go @@ -3,7 +3,7 @@ package builtin import ( "testing" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/franela/goblin" ) diff --git a/pkg/store/builtin/token.go b/pkg/store/builtin/token.go index 3f21fd87a..9fd95a609 100644 --- a/pkg/store/builtin/token.go +++ b/pkg/store/builtin/token.go @@ -1,7 +1,7 @@ package builtin import ( - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/russross/meddler" ) diff --git a/pkg/store/builtin/token_test.go b/pkg/store/builtin/token_test.go index eddf700df..3e1a88929 100644 --- a/pkg/store/builtin/token_test.go +++ b/pkg/store/builtin/token_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/franela/goblin" ) diff --git a/pkg/store/builtin/user.go b/pkg/store/builtin/user.go index 7ebcd0ec1..9bb1402ff 100644 --- a/pkg/store/builtin/user.go +++ b/pkg/store/builtin/user.go @@ -3,7 +3,7 @@ package builtin import ( "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/russross/meddler" ) diff --git a/pkg/store/builtin/users_test.go b/pkg/store/builtin/users_test.go index 0eab41f11..73831278c 100644 --- a/pkg/store/builtin/users_test.go +++ b/pkg/store/builtin/users_test.go @@ -3,7 +3,7 @@ package builtin import ( "testing" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/franela/goblin" ) diff --git a/pkg/store/mock/mock.go b/pkg/store/mock/mock.go index 6338bb91c..6493124dd 100644 --- a/pkg/store/mock/mock.go +++ b/pkg/store/mock/mock.go @@ -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" ) diff --git a/pkg/store/plugin/build.go b/pkg/store/plugin/build.go index 999ac8d55..f652eb1cf 100644 --- a/pkg/store/plugin/build.go +++ b/pkg/store/plugin/build.go @@ -3,7 +3,7 @@ package plugin import ( "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" ) type GetBuildReq struct { diff --git a/pkg/store/plugin/repo.go b/pkg/store/plugin/repo.go index 2bf1f84fc..1d21b5a04 100644 --- a/pkg/store/plugin/repo.go +++ b/pkg/store/plugin/repo.go @@ -3,7 +3,7 @@ package plugin import ( "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" ) type GetRepoReq struct { diff --git a/pkg/store/plugin/task.go b/pkg/store/plugin/task.go index 470043cf5..9be149f2d 100644 --- a/pkg/store/plugin/task.go +++ b/pkg/store/plugin/task.go @@ -1,7 +1,7 @@ package plugin import ( - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" ) type GetTaskReq struct { diff --git a/pkg/store/plugin/token.go b/pkg/store/plugin/token.go index 5c16fc793..4b65ed1d5 100644 --- a/pkg/store/plugin/token.go +++ b/pkg/store/plugin/token.go @@ -1,7 +1,7 @@ package plugin import ( - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" ) type GetTokenReq struct { diff --git a/pkg/store/plugin/user.go b/pkg/store/plugin/user.go index 78b31089b..37fe4b923 100644 --- a/pkg/store/plugin/user.go +++ b/pkg/store/plugin/user.go @@ -3,7 +3,7 @@ package plugin import ( "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" ) type GetUserReq struct { diff --git a/pkg/store/store.go b/pkg/store/store.go index 7d645fdeb..08973c2a5 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -3,7 +3,7 @@ package store import ( "io" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" ) type Store interface { diff --git a/common/agent.go b/pkg/types/agent.go similarity index 93% rename from common/agent.go rename to pkg/types/agent.go index fc35e0883..42a41d0e2 100644 --- a/common/agent.go +++ b/pkg/types/agent.go @@ -1,4 +1,4 @@ -package common +package types // Agent represents a worker that has connected // to the system in order to perform work diff --git a/common/build.go b/pkg/types/build.go similarity index 98% rename from common/build.go rename to pkg/types/build.go index 22d109824..9d8c948d7 100644 --- a/common/build.go +++ b/pkg/types/build.go @@ -1,4 +1,4 @@ -package common +package types type Build struct { ID int64 `meddler:"build_id,pk" json:"-"` diff --git a/common/clone.go b/pkg/types/clone.go similarity index 97% rename from common/clone.go rename to pkg/types/clone.go index 3ef821ef4..085e2a844 100644 --- a/common/clone.go +++ b/pkg/types/clone.go @@ -1,4 +1,4 @@ -package common +package types type Clone struct { Origin string `json:"origin"` diff --git a/common/commit.go b/pkg/types/commit.go similarity index 99% rename from common/commit.go rename to pkg/types/commit.go index 8c832fd67..09fe0ed8f 100644 --- a/common/commit.go +++ b/pkg/types/commit.go @@ -1,4 +1,4 @@ -package common +package types const ( StatePending = "pending" diff --git a/common/config.go b/pkg/types/config.go similarity index 99% rename from common/config.go rename to pkg/types/config.go index 94b5a8fe0..6a431b613 100644 --- a/common/config.go +++ b/pkg/types/config.go @@ -1,4 +1,4 @@ -package common +package types import ( "path/filepath" diff --git a/common/hook.go b/pkg/types/hook.go similarity index 77% rename from common/hook.go rename to pkg/types/hook.go index 4690ae3a8..38a522d3d 100644 --- a/common/hook.go +++ b/pkg/types/hook.go @@ -1,4 +1,4 @@ -package common +package types type Hook struct { Repo *Repo diff --git a/common/repo.go b/pkg/types/repo.go similarity index 99% rename from common/repo.go rename to pkg/types/repo.go index 040070c97..36db5a4ee 100644 --- a/common/repo.go +++ b/pkg/types/repo.go @@ -1,4 +1,4 @@ -package common +package types type Repo struct { ID int64 `meddler:"repo_id,pk" json:"id"` diff --git a/common/status.go b/pkg/types/status.go similarity index 96% rename from common/status.go rename to pkg/types/status.go index 0990be005..f147e4d2d 100644 --- a/common/status.go +++ b/pkg/types/status.go @@ -1,4 +1,4 @@ -package common +package types type Status struct { ID int64 `meddler:"status_id,pk" json:"-"` diff --git a/common/task.go b/pkg/types/task.go similarity index 96% rename from common/task.go rename to pkg/types/task.go index d266ca5d5..a16afa7e3 100644 --- a/common/task.go +++ b/pkg/types/task.go @@ -1,4 +1,4 @@ -package common +package types type Task struct { Number int `json:"number"` diff --git a/common/token.go b/pkg/types/token.go similarity index 97% rename from common/token.go rename to pkg/types/token.go index c98f47c85..e83463efa 100644 --- a/common/token.go +++ b/pkg/types/token.go @@ -1,4 +1,4 @@ -package common +package types type Token struct { ID int64 `meddler:"token_id,pk" json:"-"` diff --git a/common/user.go b/pkg/types/user.go similarity index 97% rename from common/user.go rename to pkg/types/user.go index 1f2e7530a..56f73340e 100644 --- a/common/user.go +++ b/pkg/types/user.go @@ -1,4 +1,4 @@ -package common +package types type User struct { ID int64 `meddler:"user_id,pk" json:"-"` diff --git a/common/httputil/httputil.go b/pkg/utils/httputil/httputil.go similarity index 100% rename from common/httputil/httputil.go rename to pkg/utils/httputil/httputil.go diff --git a/common/sshutil/sshutil.go b/pkg/utils/sshutil/sshutil.go similarity index 100% rename from common/sshutil/sshutil.go rename to pkg/utils/sshutil/sshutil.go diff --git a/pkg/yaml/inject/inject.go b/pkg/yaml/inject/inject.go index 1ff7795c0..6ef4fee36 100644 --- a/pkg/yaml/inject/inject.go +++ b/pkg/yaml/inject/inject.go @@ -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 } diff --git a/pkg/yaml/lint.go b/pkg/yaml/lint.go index a05396617..ef515f518 100644 --- a/pkg/yaml/lint.go +++ b/pkg/yaml/lint.go @@ -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 diff --git a/pkg/yaml/lint_test.go b/pkg/yaml/lint_test.go index e4fc50a33..450426445 100644 --- a/pkg/yaml/lint_test.go +++ b/pkg/yaml/lint_test.go @@ -3,7 +3,7 @@ package parser import ( "testing" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/franela/goblin" ) diff --git a/pkg/yaml/parse.go b/pkg/yaml/parse.go index dc1d1ed8c..6a6f420d7 100644 --- a/pkg/yaml/parse.go +++ b/pkg/yaml/parse.go @@ -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" diff --git a/pkg/yaml/trans.go b/pkg/yaml/trans.go index 09f88fa44..c38188f2c 100644 --- a/pkg/yaml/trans.go +++ b/pkg/yaml/trans.go @@ -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 diff --git a/pkg/yaml/trans_test.go b/pkg/yaml/trans_test.go index f64053dbb..4f7f8314b 100644 --- a/pkg/yaml/trans_test.go +++ b/pkg/yaml/trans_test.go @@ -3,7 +3,7 @@ package parser import ( "testing" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/franela/goblin" ) diff --git a/runner/builtin/runner.go b/runner/builtin/runner.go index fcbb132bf..06b7fb12b 100644 --- a/runner/builtin/runner.go +++ b/runner/builtin/runner.go @@ -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" diff --git a/runner/builtin/updater.go b/runner/builtin/updater.go index 86b6515cd..e7f2ba4e9 100644 --- a/runner/builtin/updater.go +++ b/runner/builtin/updater.go @@ -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 { diff --git a/runner/builtin/worker.go b/runner/builtin/worker.go index 9a3688110..81710be5d 100644 --- a/runner/builtin/worker.go +++ b/runner/builtin/worker.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "time" - "github.com/drone/drone/common" + common "github.com/drone/drone/pkg/types" "github.com/samalba/dockerclient" ) diff --git a/runner/runner.go b/runner/runner.go index c369664ab..9fd44d1da 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -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 { diff --git a/server/agent.go b/server/agent.go index 609dd8885..82664c73e 100644 --- a/server/agent.go +++ b/server/agent.go @@ -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 { diff --git a/server/badge.go b/server/badge.go index 2551455b7..bed56c181 100644 --- a/server/badge.go +++ b/server/badge.go @@ -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) diff --git a/server/badge_test.go b/server/badge_test.go index 113727a4c..b1ca646d8 100644 --- a/server/badge_test.go +++ b/server/badge_test.go @@ -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" diff --git a/server/commits.go b/server/commits.go index e5c62c4bb..043350ad8 100644 --- a/server/commits.go +++ b/server/commits.go @@ -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" diff --git a/server/hooks.go b/server/hooks.go index 1da4bab23..f9aa725c7 100644 --- a/server/hooks.go +++ b/server/hooks.go @@ -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" diff --git a/server/login.go b/server/login.go index 208265238..c52338e8e 100644 --- a/server/login.go +++ b/server/login.go @@ -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 diff --git a/server/repos.go b/server/repos.go index 45803535f..0e76df6c4 100644 --- a/server/repos.go +++ b/server/repos.go @@ -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 diff --git a/server/server.go b/server/server.go index 44700b607..bee2bfec9 100644 --- a/server/server.go +++ b/server/server.go @@ -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" diff --git a/server/session/session.go b/server/session/session.go index 608b65f9a..8d96c3b55 100644 --- a/server/session/session.go +++ b/server/session/session.go @@ -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" ) diff --git a/server/token.go b/server/token.go index 0e615cd32..7b1f21b11 100644 --- a/server/token.go +++ b/server/token.go @@ -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 diff --git a/server/user.go b/server/user.go index faba2c7b3..870dd3ee5 100644 --- a/server/user.go +++ b/server/user.go @@ -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 diff --git a/server/user_test.go b/server/user_test.go index 409608e41..2a99cd65a 100644 --- a/server/user_test.go +++ b/server/user_test.go @@ -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() { diff --git a/server/users.go b/server/users.go index 53f095afe..ba69d3c7e 100644 --- a/server/users.go +++ b/server/users.go @@ -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