Skip to content

Commit

Permalink
Merge pull request #129 from zalando-stups/switching-to-modules
Browse files Browse the repository at this point in the history
Switching to modules
  • Loading branch information
rgritti authored Dec 10, 2018
2 parents eb9afca + 520ab4d commit 2a5c6d1
Show file tree
Hide file tree
Showing 42 changed files with 324 additions and 341 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ cache:
env:
global:
- VIPS_VERSION=8.7.0
- GO111MODULE=on
- secure: iOfz4tQ/0pV+BTnnzzh0cxVHJfw6cgO+O5Gc/48rZIt0LjjIZByvMnatUv2wWlWCM01RhFy0blMAeY7twDSNzqu39voJCZzt4HL1YW8JH9/o4veEMo6MdEpJRQczlJnHpLDRXyW+EcrSunHSE1BQwbEDCBqlISlWBnVuLrvI9en+kQIQjGylazADYkwt0Dljaz73OqEhqqW6obnz7tO4OnTtRZr+lAyQxOCRsEy7Drnc19HWIfORvsAsRnjDboof2WtDoNYYiDEnD89bpiu012OZYI+wik4p2g9fyCLUOpizTI+rLYU0a3M0D6JDmL3fehF+I/s27Hh2uh9QtU8YD2FZ4LthfqkeF1uUyuikMTWI6r1N2EZiKLhFcYezB9R8H+XcsLRwZoxWHHM6OVmkeX7v7LaJYzsNWzPU7YL3Ja1Upn+f9EsK4/mi7uupOLyNUxmOBLa6Anll+IMYor5qmo8S2ahzenREURPuBdZ1OgpheFYK9+9QkkjSCzXm1NjWp1B39a3VtQ1ZVldu7NE7PVRJSWPrfi3YBlcs8qxz54GoAo2yCyPTka12iissVULWQF+fr2NuE2YEPBBZdmi+wHTCZ18V7ts3W8ww7o9ZkAPT9vDKsWVzqe1RmR6Dv+0ocYNVIpyOyL0exHFqujRtbMg4STY6zPaaibcs3bafIq8=

before_install:
- "./packaging/install-vips.sh"

install:
- go get github.com/Masterminds/glide
- go get github.com/wadey/gocovmerge
- glide install

script:
- make ci-trigger
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ RUN ./install-vips.sh
ADD . /go/src/github.com/zalando-stups/skrop
WORKDIR /go/src/github.com/zalando-stups/skrop

RUN go get github.com/Masterminds/glide

RUN glide install
ENV GO111MODULE on

RUN go build ./cmd/skrop

Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ VERSION ?= $(CURRENT_VERSION)
NEXT_PATCH = $(shell go run packaging/version/version.go patch $(CURRENT_VERSION))
COMMIT_HASH = $(shell git rev-parse --short HEAD)

glide:
glide install

build: glide
build:
go build ./cmd/skrop

docker:
Expand All @@ -29,7 +27,6 @@ test-only:

init-deps:
./packaging/build.sh
go get github.com/Masterminds/glide
go get ./cmd/skrop/

all: init-deps build test
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,10 @@ run packaging/install-vips.sh

#### GO dependencies

Only on macOS, you have to manually install _Glide_ using _Brew_.
```bash
brew install glide
```

Then, for all.
Skrop uses [modules](https://github.com/golang/go/wiki/Modules), so make sure to have go 1.11+ and just run
```
export GO111MODULE=on
./packaging/build.sh
go get github.com/Masterminds/glide
go get ./cmd/skrop/
```

Expand Down
7 changes: 0 additions & 7 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@

```bash
brew upgrade vips
brew upgrade glide
brew upgrade golang
glide update

# to clear the cache in case glide update failes
glide cc

glide install

make build-docker-vips
```
2 changes: 1 addition & 1 deletion filters/addbackground.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package filters

import (
"github.com/h2non/bimg"
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion filters/addbackground_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filters
import (
"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"testing"
)

Expand Down
2 changes: 1 addition & 1 deletion filters/blur.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

// BlurName is the name of the filter
Expand Down
2 changes: 1 addition & 1 deletion filters/blur_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filters
import (
"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"testing"
)

Expand Down
2 changes: 1 addition & 1 deletion filters/convertimagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"strings"
)

Expand Down
2 changes: 1 addition & 1 deletion filters/convertimagetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filters
import (
"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"testing"
)

Expand Down
2 changes: 1 addition & 1 deletion filters/crop.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

// CropName is the name of the filter
Expand Down
2 changes: 1 addition & 1 deletion filters/crop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filters
import (
"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"testing"
)

Expand Down
2 changes: 1 addition & 1 deletion filters/cropbyfocalpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"strconv"
)

Expand Down
2 changes: 1 addition & 1 deletion filters/cropbyheight.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

// CropByHeightName is the name of the filter
Expand Down
2 changes: 1 addition & 1 deletion filters/cropbyheight_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

func TestNewCropByHeight(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion filters/cropbywidth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

// CropByWidthName is the name of the filter
Expand Down
2 changes: 1 addition & 1 deletion filters/cropbywidth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

func TestNewCropByWidth(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion filters/finalizeresponse_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package filters

import (
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"io/ioutil"
Expand Down
2 changes: 1 addition & 1 deletion filters/imagefilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"errors"
"fmt"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/messages"
"github.com/zalando/skipper/filters"
Expand Down
2 changes: 1 addition & 1 deletion filters/imagefilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"testing"

"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/zalando/skipper/filters/filtertest"
Expand Down
2 changes: 1 addition & 1 deletion filters/imagefiltertest/imagefiltertest.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

const (
Expand Down
46 changes: 24 additions & 22 deletions filters/localfilecache_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package filters

import (
"github.com/zalando-stups/skrop/cache"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/zalando/skipper/filters"
"github.com/zalando/skipper/filters/filtertest"
"io/ioutil"
"net/http"
"net/http/httptest"
Expand All @@ -14,16 +10,22 @@ import (
"testing"
"time"

"github.com/zalando-stups/skrop/cache"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/zalando/skipper/filters"
"github.com/zalando/skipper/filters/filtertest"

"github.com/stretchr/testify/assert"
)

type metricsHandler struct{}

var emptyMeta map[string]*string = make(map[string]*string)
type noopMetricHandler struct{}

func (f *metricsHandler) MeasureSince(key string, start time.Time) {}
var emptyMeta = make(map[string]*string)

func (f *metricsHandler) IncCounter(key string) {}
func (f *noopMetricHandler) MeasureSince(key string, start time.Time) {}
func (f *noopMetricHandler) IncCounter(key string) {}
func (f *noopMetricHandler) IncCounterBy(key string, value int64) {}
func (f *noopMetricHandler) IncFloatCounterBy(key string, value float64) {}

func TestLocalFileCache_NewLocalFileCache(t *testing.T) {
cache := cache.NewFileSystemCache()
Expand All @@ -43,17 +45,17 @@ func TestLocalFileCache_CreateFilter(t *testing.T) {
cache := cache.NewFileSystemCache()
imagefiltertest.TestCreate(t, func() filters.Spec { return NewLocalFileCache(cache) },
[]imagefiltertest.CreateTestItem{{
"no args",
nil,
true,
Msg: "no args",
Args: nil,
Err: true,
}, {
"one arg",
[]interface{}{"/tmp"},
false,
Msg: "one arg",
Args: []interface{}{"/tmp"},
Err: false,
}, {
"two args",
[]interface{}{"/tmp", "hello"},
true,
Msg: "two args",
Args: []interface{}{"/tmp", "hello"},
Err: true,
}})
}

Expand Down Expand Up @@ -86,7 +88,7 @@ func TestLocalFileCache_Request_NoCache(t *testing.T) {
f, _ := cacheFilter.CreateFilter([]interface{}{"/images"})
req, _ := http.NewRequest("GET", "http://www.example.org"+reqPath+"?refresh=true", nil)

ctx := &filtertest.Context{FRequest: req, FMetrics: &metricsHandler{}}
ctx := &filtertest.Context{FRequest: req, FMetrics: &noopMetricHandler{}}
f.Request(ctx)

assert.False(t, ctx.Served())
Expand All @@ -100,7 +102,7 @@ func TestLocalFileCache_Request_NotInCache(t *testing.T) {
f, _ := cacheFilter.CreateFilter([]interface{}{"/images"})
req, _ := http.NewRequest("GET", "http://www.example.org"+reqPath, nil)

ctx := &filtertest.Context{FRequest: req, FMetrics: &metricsHandler{}}
ctx := &filtertest.Context{FRequest: req, FMetrics: &noopMetricHandler{}}
f.Request(ctx)

assert.False(t, ctx.Served())
Expand All @@ -115,7 +117,7 @@ func TestLocalFileCache_Request_InCache(t *testing.T) {
f, _ := cacheFilter.CreateFilter([]interface{}{"../images"})
req, _ := http.NewRequest("GET", "http://www.example.org"+reqPath, nil)

ctx := &filtertest.Context{FRequest: req, FMetrics: &metricsHandler{}}
ctx := &filtertest.Context{FRequest: req, FMetrics: &noopMetricHandler{}}
f.Request(ctx)

assert.True(t, ctx.Served())
Expand Down Expand Up @@ -150,7 +152,7 @@ func TestLocalFileCache_Response(t *testing.T) {
req, _ := http.NewRequest("GET", "http://www.example.org"+reqPath, nil)
recorder := httptest.NewRecorder()

ctx := &filtertest.Context{FRequest: req, FMetrics: &metricsHandler{}, FResponse: recorder.Result()}
ctx := &filtertest.Context{FRequest: req, FMetrics: &noopMetricHandler{}, FResponse: recorder.Result()}
f.Response(ctx)

assert.Equal(t, "200 OK", ctx.Response().Status)
Expand Down
2 changes: 1 addition & 1 deletion filters/longeredgeresize.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

// LongerEdgeResizeName is the name of the filter
Expand Down
2 changes: 1 addition & 1 deletion filters/longeredgeresize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

func TestNewLongerEdgeResize(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion filters/overlayImage.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filters
import (
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"io/ioutil"
"os"
)
Expand Down
2 changes: 1 addition & 1 deletion filters/overlayimage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filters
import (
"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"testing"
)

Expand Down
2 changes: 1 addition & 1 deletion filters/quality.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
log "github.com/sirupsen/logrus"
"github.com/zalando-stups/skrop/parse"
"github.com/zalando/skipper/filters"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
)

// QualityName is the name of the filter
Expand Down
2 changes: 1 addition & 1 deletion filters/quality_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filters
import (
"github.com/stretchr/testify/assert"
"github.com/zalando-stups/skrop/filters/imagefiltertest"
"github.com/danpersa/bimg"
"github.com/h2non/bimg"
"testing"
)

Expand Down
Loading

0 comments on commit 2a5c6d1

Please sign in to comment.