Skip to content

Commit

Permalink
Move server code into server package
Browse files Browse the repository at this point in the history
  • Loading branch information
lkysow committed Oct 18, 2017
1 parent 6eeb61d commit a2b6f2b
Show file tree
Hide file tree
Showing 40 changed files with 83 additions and 76 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions server/apply_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions server/command_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions server/command_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion server/event_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions server/event_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion github/client.go → server/github/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
4 changes: 2 additions & 2 deletions server/github_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions server/github_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion locking/locking.go → server/locking/locking.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions locking/locking_test.go → server/locking/locking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion server/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"strings"

"github.com/hootsuite/atlantis/logging"
"github.com/hootsuite/atlantis/server/logging"
"github.com/urfave/negroni"
)

Expand Down
2 changes: 1 addition & 1 deletion server/mocks/mock_event_parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion server/mocks/mock_github_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion server/mocks/mock_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions server/plan_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
6 changes: 3 additions & 3 deletions server/pull_closed_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
8 changes: 4 additions & 4 deletions server/pull_closed_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion run/run.go → server/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion run/run_test.go → server/run/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
16 changes: 8 additions & 8 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit a2b6f2b

Please sign in to comment.