Move server code into server package

This commit is contained in:
Luke Kysow
2017-10-14 11:40:42 -07:00
parent 6eeb61d790
commit a2b6f2b4f1
40 changed files with 83 additions and 76 deletions

View File

@@ -25,6 +25,9 @@ deps: ## Download dependencies
build-service: ## Build the main Go service
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o atlantis .
go-generate: ## Run go generate in all packages
go generate $(PKG)
test: ## Run tests, coverage reports, and clean (coverage taints the compiled code)
go test $(PKG)
@@ -36,7 +39,7 @@ test-coverage-html:
go tool cover -html .cover/cover.out
dist: ## Package up everything in static/ using go-bindata-assetfs so it can be served by a single binary
go-bindata-assetfs -pkg static static/... && mv bindata_assetfs.go static
rm -f server/static/bindata_assetfs.go && go-bindata-assetfs -pkg static -prefix server server/static/... && mv bindata_assetfs.go server/static
release: ## Create packages for a release
./scripts/binary-release.sh

View File

@@ -9,11 +9,11 @@ import (
"path/filepath"
version "github.com/hashicorp/go-version"
"github.com/hootsuite/atlantis/github"
"github.com/hootsuite/atlantis/locking"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/run"
"github.com/hootsuite/atlantis/terraform"
"github.com/hootsuite/atlantis/server/github"
"github.com/hootsuite/atlantis/server/locking"
"github.com/hootsuite/atlantis/server/models"
"github.com/hootsuite/atlantis/server/run"
"github.com/hootsuite/atlantis/server/terraform"
)
type ApplyExecutor struct {

View File

@@ -3,9 +3,9 @@ package server
import (
"fmt"
"github.com/hootsuite/atlantis/github"
"github.com/hootsuite/atlantis/logging"
"github.com/hootsuite/atlantis/recovery"
"github.com/hootsuite/atlantis/server/github"
"github.com/hootsuite/atlantis/server/logging"
"github.com/hootsuite/atlantis/server/recovery"
)
// CommandHandler is the first step when processing a comment command.

View File

@@ -9,10 +9,10 @@ import (
"strings"
"github.com/google/go-github/github"
gh "github.com/hootsuite/atlantis/github/fixtures"
ghmocks "github.com/hootsuite/atlantis/github/mocks"
"github.com/hootsuite/atlantis/logging"
"github.com/hootsuite/atlantis/models/fixtures"
gh "github.com/hootsuite/atlantis/server/github/fixtures"
ghmocks "github.com/hootsuite/atlantis/server/github/mocks"
"github.com/hootsuite/atlantis/server/logging"
"github.com/hootsuite/atlantis/server/models/fixtures"
"github.com/hootsuite/atlantis/server"
"github.com/hootsuite/atlantis/server/mocks"
. "github.com/hootsuite/atlantis/testing_util"

View File

@@ -6,10 +6,11 @@ import (
"strings"
"github.com/google/go-github/github"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/models"
)
//go:generate pegomock generate --use-experimental-model-gen --package mocks -o mocks/mock_event_parsing.go EventParsing
//go:generate sed -i "" -e "s#github.com/hootsuite/atlantis/vendor/github.com/google/go-github/github#github.com/google/go-github/github#" mocks/mock_event_parsing.go
type Command struct {
Name CommandName

View File

@@ -7,8 +7,8 @@ import (
"strings"
"github.com/google/go-github/github"
. "github.com/hootsuite/atlantis/github/fixtures"
"github.com/hootsuite/atlantis/models"
. "github.com/hootsuite/atlantis/server/github/fixtures"
"github.com/hootsuite/atlantis/server/models"
"github.com/hootsuite/atlantis/server"
. "github.com/hootsuite/atlantis/testing_util"
"github.com/mohae/deepcopy"

View File

@@ -9,7 +9,7 @@ import (
"strings"
"github.com/google/go-github/github"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/models"
"github.com/pkg/errors"
)

View File

@@ -5,7 +5,7 @@ package mocks
import (
github "github.com/google/go-github/github"
models "github.com/hootsuite/atlantis/models"
models "github.com/hootsuite/atlantis/server/models"
pegomock "github.com/petergtz/pegomock"
"reflect"
)

View File

@@ -5,8 +5,8 @@ import (
"strings"
"github.com/hootsuite/atlantis/github"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/github"
"github.com/hootsuite/atlantis/server/models"
)
type Status int

View File

@@ -6,8 +6,8 @@ import (
"errors"
"strings"
"github.com/hootsuite/atlantis/github/mocks"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/github/mocks"
"github.com/hootsuite/atlantis/server/models"
"github.com/hootsuite/atlantis/server"
. "github.com/hootsuite/atlantis/testing_util"
. "github.com/petergtz/pegomock"

View File

@@ -12,7 +12,7 @@ import (
"time"
"github.com/boltdb/bolt"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/models"
"github.com/pkg/errors"
)

View File

@@ -12,8 +12,8 @@ import (
"time"
"github.com/hootsuite/atlantis/locking/boltdb"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/models"
"github.com/hootsuite/atlantis/server/locking/boltdb"
)
var lockBucket = "bucket"

View File

@@ -7,7 +7,7 @@ import (
"regexp"
"time"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/models"
)
//go:generate pegomock generate --use-experimental-model-gen --package mocks -o mocks/mock_backend.go Backend

View File

@@ -8,11 +8,11 @@ import (
"reflect"
"strings"
"github.com/hootsuite/atlantis/locking"
"github.com/hootsuite/atlantis/locking/mocks"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/locking/mocks"
"github.com/hootsuite/atlantis/server/models"
. "github.com/hootsuite/atlantis/testing_util"
. "github.com/petergtz/pegomock"
"github.com/hootsuite/atlantis/server/locking"
)
var project = models.NewProject("owner/repo", "path")

View File

@@ -1,10 +1,10 @@
// Automatically generated by pegomock. DO NOT EDIT!
// Source: github.com/hootsuite/atlantis/locking (interfaces: Backend)
// Source: github.com/hootsuite/atlantis/server/locking (interfaces: Backend)
package mocks
import (
models "github.com/hootsuite/atlantis/models"
models "github.com/hootsuite/atlantis/server/models"
pegomock "github.com/petergtz/pegomock"
"reflect"
)

View File

@@ -1,11 +1,11 @@
// Automatically generated by pegomock. DO NOT EDIT!
// Source: github.com/hootsuite/atlantis/locking (interfaces: Locker)
// Source: github.com/hootsuite/atlantis/server/locking (interfaces: Locker)
package mocks
import (
locking "github.com/hootsuite/atlantis/locking"
models "github.com/hootsuite/atlantis/models"
locking "github.com/hootsuite/atlantis/server/locking"
models "github.com/hootsuite/atlantis/server/models"
pegomock "github.com/petergtz/pegomock"
"reflect"
)

View File

@@ -5,7 +5,7 @@ import (
"strings"
"github.com/hootsuite/atlantis/logging"
"github.com/hootsuite/atlantis/server/logging"
"github.com/urfave/negroni"
)

View File

@@ -4,8 +4,8 @@
package mocks
import (
models "github.com/hootsuite/atlantis/models"
server "github.com/hootsuite/atlantis/server"
models "github.com/hootsuite/atlantis/server/models"
github "github.com/google/go-github/github"
pegomock "github.com/petergtz/pegomock"
"reflect"

View File

@@ -4,8 +4,8 @@
package mocks
import (
models "github.com/hootsuite/atlantis/models"
server "github.com/hootsuite/atlantis/server"
models "github.com/hootsuite/atlantis/server/models"
pegomock "github.com/petergtz/pegomock"
"reflect"
)

View File

@@ -4,8 +4,8 @@
package mocks
import (
models "github.com/hootsuite/atlantis/models"
server "github.com/hootsuite/atlantis/server"
models "github.com/hootsuite/atlantis/server/models"
pegomock "github.com/petergtz/pegomock"
"reflect"
)

View File

@@ -1,6 +1,6 @@
package fixtures
import "github.com/hootsuite/atlantis/models"
import "github.com/hootsuite/atlantis/server/models"
var Pull = models.PullRequest{
Num: 1,

View File

@@ -8,11 +8,11 @@ import (
"strings"
version "github.com/hashicorp/go-version"
"github.com/hootsuite/atlantis/github"
"github.com/hootsuite/atlantis/locking"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/run"
"github.com/hootsuite/atlantis/terraform"
"github.com/hootsuite/atlantis/server/github"
"github.com/hootsuite/atlantis/server/locking"
"github.com/hootsuite/atlantis/server/models"
"github.com/hootsuite/atlantis/server/run"
"github.com/hootsuite/atlantis/server/terraform"
"github.com/pkg/errors"
)

View File

@@ -6,9 +6,9 @@ import (
"strings"
"text/template"
"github.com/hootsuite/atlantis/github"
"github.com/hootsuite/atlantis/locking"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/github"
"github.com/hootsuite/atlantis/server/locking"
"github.com/hootsuite/atlantis/server/models"
"github.com/pkg/errors"
)

View File

@@ -5,10 +5,10 @@ import (
"reflect"
"testing"
ghmocks "github.com/hootsuite/atlantis/github/mocks"
lockmocks "github.com/hootsuite/atlantis/locking/mocks"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/models/fixtures"
ghmocks "github.com/hootsuite/atlantis/server/github/mocks"
lockmocks "github.com/hootsuite/atlantis/server/locking/mocks"
"github.com/hootsuite/atlantis/server/models"
"github.com/hootsuite/atlantis/server/models/fixtures"
"github.com/hootsuite/atlantis/server"
"github.com/hootsuite/atlantis/server/mocks"
. "github.com/hootsuite/atlantis/testing_util"

View File

@@ -11,7 +11,7 @@ import (
"strings"
version "github.com/hashicorp/go-version"
"github.com/hootsuite/atlantis/logging"
"github.com/hootsuite/atlantis/server/logging"
"github.com/pkg/errors"
)

View File

@@ -4,7 +4,7 @@ import (
"testing"
version "github.com/hashicorp/go-version"
"github.com/hootsuite/atlantis/logging"
"github.com/hootsuite/atlantis/server/logging"
. "github.com/hootsuite/atlantis/testing_util"
)

View File

@@ -14,14 +14,14 @@ import (
"github.com/elazarl/go-bindata-assetfs"
gh "github.com/google/go-github/github"
"github.com/gorilla/mux"
"github.com/hootsuite/atlantis/github"
"github.com/hootsuite/atlantis/locking"
"github.com/hootsuite/atlantis/locking/boltdb"
"github.com/hootsuite/atlantis/logging"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/run"
"github.com/hootsuite/atlantis/static"
"github.com/hootsuite/atlantis/terraform"
"github.com/hootsuite/atlantis/server/github"
"github.com/hootsuite/atlantis/server/locking"
"github.com/hootsuite/atlantis/server/locking/boltdb"
"github.com/hootsuite/atlantis/server/logging"
"github.com/hootsuite/atlantis/server/models"
"github.com/hootsuite/atlantis/server/run"
"github.com/hootsuite/atlantis/server/static"
"github.com/hootsuite/atlantis/server/terraform"
"github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
"github.com/urfave/cli"

View File

@@ -1,11 +1,11 @@
// Code generated by go-bindata.
// sources:
// static/css/custom.css
// static/css/normalize.css
// static/css/skeleton.css
// static/images/atlantis-icon.png
// static/images/atlantis-icon_512.png
// static/js/jquery-3.2.1.min.js
// server/static/css/custom.css
// server/static/css/normalize.css
// server/static/css/skeleton.css
// server/static/images/atlantis-icon.png
// server/static/images/atlantis-icon_512.png
// server/static/js/jquery-3.2.1.min.js
// DO NOT EDIT!
package static
@@ -89,7 +89,7 @@ func staticCssCustomCss() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "static/css/custom.css", size: 6701, mode: os.FileMode(420), modTime: time.Unix(1498689570, 0)}
info := bindataFileInfo{name: "static/css/custom.css", size: 6701, mode: os.FileMode(420), modTime: time.Unix(1499622019, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -109,7 +109,7 @@ func staticCssNormalizeCss() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "static/css/normalize.css", size: 7797, mode: os.FileMode(420), modTime: time.Unix(1495690053, 0)}
info := bindataFileInfo{name: "static/css/normalize.css", size: 7797, mode: os.FileMode(420), modTime: time.Unix(1499622019, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -129,7 +129,7 @@ func staticCssSkeletonCss() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "static/css/skeleton.css", size: 11452, mode: os.FileMode(420), modTime: time.Unix(1495690053, 0)}
info := bindataFileInfo{name: "static/css/skeleton.css", size: 11452, mode: os.FileMode(420), modTime: time.Unix(1499622019, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -149,7 +149,7 @@ func staticImagesAtlantisIconPng() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "static/images/atlantis-icon.png", size: 4238, mode: os.FileMode(420), modTime: time.Unix(1501691854, 0)}
info := bindataFileInfo{name: "static/images/atlantis-icon.png", size: 4238, mode: os.FileMode(420), modTime: time.Unix(1501647554, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -169,7 +169,7 @@ func staticImagesAtlantisIcon_512Png() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "static/images/atlantis-icon_512.png", size: 49782, mode: os.FileMode(420), modTime: time.Unix(1501691854, 0)}
info := bindataFileInfo{name: "static/images/atlantis-icon_512.png", size: 49782, mode: os.FileMode(420), modTime: time.Unix(1501647554, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -189,7 +189,7 @@ func staticJsJquery321MinJs() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "static/js/jquery-3.2.1.min.js", size: 86659, mode: os.FileMode(420), modTime: time.Unix(1498689570, 0)}
info := bindataFileInfo{name: "static/js/jquery-3.2.1.min.js", size: 86659, mode: os.FileMode(420), modTime: time.Unix(1499622019, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -359,8 +359,11 @@ func _filePath(dir, name string) string {
func assetFS() *assetfs.AssetFS {
assetInfo := func(path string) (os.FileInfo, error) {
return os.Stat(path)
}
for k := range _bintree.Children {
return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: k}
return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: assetInfo, Prefix: k}
}
panic("unreachable")
}

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -10,7 +10,7 @@ import (
"strings"
version "github.com/hashicorp/go-version"
"github.com/hootsuite/atlantis/logging"
"github.com/hootsuite/atlantis/server/logging"
"github.com/pkg/errors"
)

View File

@@ -6,7 +6,7 @@ import (
"path/filepath"
"strconv"
"github.com/hootsuite/atlantis/models"
"github.com/hootsuite/atlantis/server/models"
"github.com/pkg/errors"
)