diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 270c003..0000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM golang:1.4 - -COPY . /go/src/github.com/nickschuch/marco -WORKDIR /go/src/github.com/nickschuch/marco - -RUN go get github.com/Sirupsen/logrus -RUN go get gopkg.in/alecthomas/kingpin.v1 -RUN go get github.com/samalba/dockerclient -RUN go get github.com/nickschuch/go-tutum/tutum -RUN go get github.com/daryl/cash - -RUN go build - -EXPOSE 80 -ENTRYPOINT ["./marco"] -CMD ["--help"] diff --git a/Gofile b/Gofile new file mode 100644 index 0000000..83be897 --- /dev/null +++ b/Gofile @@ -0,0 +1,10 @@ +gopkg.in/alecthomas/kingpin.v1 55a69a226d28a43b913720f5d765706d49c8fa9e +gopkg.in/yaml.v2 49c95bdc21843256fb6c4e0d370a05f24a0bf213 +github.com/stretchr/objx cbeaeb16a013161a98496fad62933b1d21786672 +github.com/daryl/cash 0cc867cf30758029421e9958774f39a67bfea88d +github.com/samalba/dockerclient adc6ab28ecbe4ab3b6bd04c68cbf8fa9b21a2684 +github.com/Sirupsen/logrus aaf92c95712104318fc35409745f1533aa5ff327 +github.com/nickschuch/go-tutum 356494f2fb34ff79ac1b012a89177dda95b5918f +github.com/stretchr/testify e22aedd37671fb115be6c0c25129c405cb575cfd +github.com/BurntSushi/toml 056c9bc7be7190eaa7715723883caffa5f8fa3e4 +github.com/alecthomas/units 6b4e7dc5e3143b85ea77909c72caf89416fc2915 diff --git a/Makefile b/Makefile index 3a8ba46..27581b0 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ #!/usr/bin/make -f +PROJCET=marco SHELL=/bin/bash MKDIR=mkdir GIT=git GO=go RM=rm -rf -CROSS=https://github.com/davecheney/golang-crosscompile.git -CROSS_BASH=source golang-crosscompile/crosscompile.bash +CROSS_BASH=source /opt/golang/cross/crosscompile.bash SOURCE=main.go TARGETS=darwin-386 darwin-amd64 linux-386 linux-amd64 linux-arm @@ -14,45 +14,31 @@ TARGETS=darwin-386 darwin-amd64 linux-386 linux-amd64 linux-arm all: test build: deps - @echo "Building marco..." - @$(GO) build -o bin/marco $(SOURCE) + @echo "Building..." + @$(GO) build -o bin/$(PROJCET) $(SOURCE) deps: @echo "Downloading libraries..." - @$(GO) get github.com/stretchr/objx - @$(GO) get github.com/daryl/cash - @$(GO) get github.com/samalba/dockerclient - @$(GO) get github.com/Sirupsen/logrus - @$(GO) get github.com/nickschuch/go-tutum/tutum - @$(GO) get gopkg.in/alecthomas/kingpin.v1 - @$(GO) get github.com/stretchr/testify/assert - -golang-crosscompile: - $(GIT) clone $(CROSS) - $(CROSS_BASH) && \ - go-crosscompile-build-all - -xbuild: deps golang-crosscompile dirs + go-getter Gofile + +xbuild: deps dirs @for target in $(TARGETS); do \ - echo "Building marco for $$target..."; \ + echo "Building for $$target..."; \ $(CROSS_BASH) && \ - $(GO)-$$target build -o bin/marco-$$target $(SOURCE); \ + $(GO)-$$target build -o bin/$(PROJCET)-$$target $(SOURCE); \ done; dirs: @$(MKDIR) -p bin test: build - @echo "Run tests..." + @echo "Running tests..." @$(GO) test ./... clean: - @echo "Cleanup binaries..." + @echo "Cleaning up binaries..." $(RM) bin -realclean: clean - $(RM) golang-crosscompile - coverage: - # This is a script provided by upstream. We won't to need this in 1.5 of Golang. - scripts/coverage.sh + @echo "Build code coverage..." + coverage diff --git a/Vagrantfile b/Vagrantfile index 0f4fa5e..65cf399 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,19 +1,5 @@ -# Backup -# -# Provides a local development environment for Marco. -# - Vagrant.configure("2") do |config| - config.vm.box = "ubuntu/trusty64" + config.vm.box = "nickschuch/go" config.vm.host_name = "marco.dev" - - config.vm.network :private_network, :ip => "192.168.80.10" - config.vm.synced_folder ".", "/opt/golang/src/github.com/nickschuch/marco" - - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--memory", 1024] - end - - config.vm.provision "shell", path: "scripts/provision.sh" end diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..53e704e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +build: + image: "nickschuch/local-go" + working_dir: "/opt/golang/src/github.com/nickschuch/marco" + volumes: + - ".:/opt/golang/src/github.com/nickschuch/marco" diff --git a/scripts/coverage.sh b/scripts/coverage.sh deleted file mode 100755 index e69ba54..0000000 --- a/scripts/coverage.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# -# Take from https://github.com/mlafeldt/chef-runner/blob/v0.7.0/script/coverage -# -# Generate test coverage statistics for Go packages. -# -# Works around the fact that `go test -coverprofile` currently does not work -# with multiple packages, see https://code.google.com/p/go/issues/detail?id=6909 -# -# Usage: script/coverage [--html|--coveralls] -# -# --html Additionally create HTML report and open it in browser -# --coveralls Push coverage statistics to coveralls.io -# - -set -e - -workdir=.cover -profile="$workdir/cover.out" -mode=count - -generate_cover_data() { - rm -rf "$workdir" - mkdir "$workdir" - - for pkg in "$@"; do - f="$workdir/$(echo $pkg | tr / -).cover" - go test -covermode="$mode" -coverprofile="$f" "$pkg" - done - - echo "mode: $mode" >"$profile" - grep -h -v "^mode:" "$workdir"/*.cover >>"$profile" -} - -show_cover_report() { - go tool cover -${1}="$profile" -} - -push_to_coveralls() { - echo "Pushing coverage statistics to coveralls.io" - goveralls -coverprofile="$profile" -} - -generate_cover_data $(go list ./...) -show_cover_report func -case "$1" in -"") - ;; ---html) - show_cover_report html ;; ---coveralls) - push_to_coveralls ;; -*) - echo >&2 "error: invalid option: $1"; exit 1 ;; -esac diff --git a/scripts/provision.sh b/scripts/provision.sh deleted file mode 100644 index 925e1cd..0000000 --- a/scripts/provision.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Name: provision.sh -# Author: Nick Schuch -# Description: Provisions an environment for testing Golang. - -# Install Golang so we can compile and run. -GOBALL="go1.4.1.linux-amd64.tar.gz" - -echo "Download and build ${GOBALL}" -cd /tmp -wget -q https://storage.googleapis.com/golang/${GOBALL} -tar -C /usr/local -xzf ${GOBALL} -chown -R vagrant:vagrant /usr/local/go -mkdir -p /opt/golang -chmod -R 777 /opt/golang - -echo 'GOPATH=/opt/golang' >> /etc/environment -echo 'PATH=$PATH:/usr/local/go/bin' >> /etc/profile -echo 'PATH=$PATH:/opt/golang/bin' >> /etc/profile -export GOPATH=/opt/golang -export PATH=$PATH:/usr/local/go/bin -export PATH=$PATH:/opt/golang/bin - -# Some other random packages. -export DEBIAN_FRONTEND=noninteractive -sudo -E apt-get install -y vim make git