Skip to content

Commit

Permalink
Initial port of gilt to golang
Browse files Browse the repository at this point in the history
Basic overlay implementation.  Will accept a gilt.yml
like the following and extract to dest.

    ---
    - url: https://github.com/retr0h/ansible-etcd.git
      version: 77a95b7
      dst: roles/retr0h.ansible-etcd

This port differs from the python version.  The python
version can clone a branch or tag.  This version __only__
clones versions pointing to SHAs into a hashed directory
structure similar to `dep`.

* Unit tests.
* CLI integration tests with bats.
* Schema validation of config file.

To test things have exported variables and interfaces, which
feels kinda wrong.
  • Loading branch information
retr0h committed Aug 4, 2018
1 parent b2e098a commit 078f952
Show file tree
Hide file tree
Showing 294 changed files with 53,227 additions and 2,556 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
*.egg-info/
*.py[cod]
.cache/
.coverage
.eggs/
.tox/
doc/build/
.build/
coverage*
3 changes: 0 additions & 3 deletions .style.yapf

This file was deleted.

14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
sudo: falseo
language: go
go:
- 1.10.x
git:
depth: 1
install:
- go get golang.org/x/lint/golint
- go get github.com/mattn/goveralls
script:
- make test
- make cover
- ${GOPATH}/bin/goveralls -coverprofile=coverage-all.out -service=travis-ci
20 changes: 0 additions & 20 deletions AUTHORS.rst

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# History

## 0.0.1

* Ported to golang.
27 changes: 0 additions & 27 deletions CHANGELOG.rst

This file was deleted.

49 changes: 0 additions & 49 deletions CONTRIBUTING.rst

This file was deleted.

87 changes: 87 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.

[[constraint]]
name = "github.com/spf13/cobra"

[[constraint]]
name = "gopkg.in/src-d/go-git"

[[constraint]]
name = "github.com/xeipuuv/gojsonschema"

[[constraint]]
name = "github.com/stretchr/testify"

[[constraint]]
name = "github.com/ghodss/yaml"

[[constraint]]
name = "github.com/kami-zh/go-capturer"

[[constraint]]
name = "github.com/logrusorgru/aurora"
12 changes: 6 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)
The MIT License

Copyright (c) 2016 Cisco Systems, Inc.
Copyright (c) 2018 John Dewey

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
64 changes: 64 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
VENDOR := vendor
PKGS := $(shell go list ./... | grep -v /$(VENDOR)/)
$(if $(PKGS), , $(error "go list failed"))
PKGS_DELIM := $(shell echo $(PKGS) | sed -e 's/ /,/g')
GITCOMMIT ?= $(shell git rev-parse --short HEAD)
$(if $(GITCOMMIT), , $(error "git rev-parse failed"))
GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
ifneq ($(GITUNTRACKEDCHANGES),)
GITCOMMIT := $(GITCOMMIT)-dirty
endif
VERSION ?= $(shell git describe --tags --always)
$(if $(VERSION), , $(error "git describe failed"))
BUILDDATE := $(shell date '+%Y/%m/%d %H:%M:%S')
LDFLAGS := -s \
-w \
-X 'main.version=$(VERSION)' \
-X 'main.buildHash=$(GITCOMMIT)' \
-X 'main.buildDate=$(BUILDDATE)'
BUILDDIR := .build
export GOCACHE = off

test: fmt lint vet bats
@echo "+ $@"
@go test -parallel 5 -covermode=count ./...

bats:
@echo "+ $@"
@./test/integration/vendor/bats/bin/bats test/integration

cover:
@echo "+ $@"
$(shell [ -e coverage.out ] && rm coverage.out)
@echo "mode: count" > coverage-all.out
$(foreach pkg,$(PKGS),\
go test -coverprofile=coverage.out -covermode=count $(pkg);\
tail -n +2 coverage.out >> coverage-all.out;)
@go tool cover -html=coverage-all.out -o=coverage-all.html

fmt:
@echo "+ $@"
@gofmt -s -l . | grep -v $(VENDOR) | tee /dev/stderr

lint:
@echo "+ $@"
@golint ./... | grep -v $(VENDOR) | tee /dev/stderr

vet:
@echo "+ $@"
@go vet $(shell go list ./... | grep -v $(VENDOR))

clean:
@echo "+ $@"
@rm -rf $(BUILDDIR)

build: clean
@echo "+ $@"
@docker run --rm -it \
-v $(CURDIR):/gopath/src/github.com/retr0h/go-gilt \
-w /gopath/src/github.com/retr0h/go-gilt \
tcnksm/gox:1.10.3 \
gox \
-ldflags="$(LDFLAGS)" \
-osarch="linux/amd64 darwin/amd64" \
-output="$(BUILDDIR)/{{.Dir}}_{{.OS}}_{{.Arch}}"
Loading

0 comments on commit 078f952

Please sign in to comment.