Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cf0af94
Showing
7 changed files
with
590 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
|
||
# Created by https://www.gitignore.io/api/macos,windows,go,vim,emacs,sublimetext,textmate,visualstudiocode,windows,eclipse | ||
|
||
### macOS ### | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
# Thumbnails | ||
._* | ||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
|
||
### Windows ### | ||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
|
||
### Go ### | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.exe | ||
*.test | ||
*.prof | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# external packages folder | ||
vendor/ | ||
|
||
|
||
### Vim ### | ||
# swap | ||
[._]*.s[a-w][a-z] | ||
[._]s[a-w][a-z] | ||
# session | ||
Session.vim | ||
# temporary | ||
.netrwhist | ||
*~ | ||
# auto-generated tag files | ||
tags | ||
|
||
|
||
### Emacs ### | ||
# -*- mode: gitignore; -*- | ||
\#*\# | ||
/.emacs.desktop | ||
/.emacs.desktop.lock | ||
*.elc | ||
auto-save-list | ||
tramp | ||
.\#* | ||
|
||
# Org-mode | ||
.org-id-locations | ||
*_archive | ||
|
||
# flymake-mode | ||
*_flymake.* | ||
|
||
# eshell files | ||
/eshell/history | ||
/eshell/lastdir | ||
|
||
# elpa packages | ||
/elpa/ | ||
|
||
# reftex files | ||
*.rel | ||
|
||
# AUCTeX auto folder | ||
/auto/ | ||
|
||
# cask packages | ||
.cask/ | ||
dist/ | ||
|
||
# Flycheck | ||
flycheck_*.el | ||
|
||
# server auth directory | ||
/server/ | ||
|
||
# projectiles files | ||
.projectile | ||
|
||
# directory configuration | ||
.dir-locals.el | ||
|
||
|
||
### SublimeText ### | ||
# cache files for sublime text | ||
*.tmlanguage.cache | ||
*.tmPreferences.cache | ||
*.stTheme.cache | ||
|
||
# workspace files are user-specific | ||
*.sublime-workspace | ||
|
||
# project files should be checked into the repository, unless a significant | ||
# proportion of contributors will probably not be using SublimeText | ||
# *.sublime-project | ||
|
||
# sftp configuration file | ||
sftp-config.json | ||
|
||
# Package control specific files | ||
Package Control.last-run | ||
Package Control.ca-list | ||
Package Control.ca-bundle | ||
Package Control.system-ca-bundle | ||
Package Control.cache/ | ||
Package Control.ca-certs/ | ||
bh_unicode_properties.cache | ||
|
||
# Sublime-github package stores a github token in this file | ||
# https://packagecontrol.io/packages/sublime-github | ||
GitHub.sublime-settings | ||
|
||
|
||
### TextMate ### | ||
*.tmproj | ||
*.tmproject | ||
tmtags | ||
|
||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
|
||
### Windows ### | ||
# Windows image file caches | ||
|
||
# Folder config file | ||
|
||
# Recycle Bin used on file shares | ||
|
||
# Windows Installer files | ||
|
||
# Windows shortcuts | ||
|
||
|
||
### Eclipse ### | ||
|
||
.metadata | ||
bin/ | ||
tmp/ | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
local.properties | ||
.settings/ | ||
.loadpath | ||
.recommenders | ||
|
||
# Eclipse Core | ||
.project | ||
|
||
# External tool builders | ||
.externalToolBuilders/ | ||
|
||
# Locally stored "Eclipse launch configurations" | ||
*.launch | ||
|
||
# PyDev specific (Python IDE for Eclipse) | ||
*.pydevproject | ||
|
||
# CDT-specific (C/C++ Development Tooling) | ||
.cproject | ||
|
||
# JDT-specific (Eclipse Java Development Tools) | ||
.classpath | ||
|
||
# Java annotation processor (APT) | ||
.factorypath | ||
|
||
# PDT-specific (PHP Development Tools) | ||
.buildpath | ||
|
||
# sbteclipse plugin | ||
.target | ||
|
||
# Tern plugin | ||
.tern-project | ||
|
||
# TeXlipse plugin | ||
.texlipse | ||
|
||
# STS (Spring Tool Suite) | ||
.springBeans | ||
|
||
# Code Recommenders | ||
.recommenders/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
# Metadata about this makefile and position | ||
MKFILE_PATH := $(lastword $(MAKEFILE_LIST)) | ||
CURRENT_DIR := $(dir $(realpath $(MKFILE_PATH))) | ||
CURRENT_DIR := $(CURRENT_DIR:/=) | ||
|
||
# Get the project metadata | ||
GOVERSION := 1.7.4 | ||
VERSION := 0.1.0 | ||
PROJECT := github.com/hashicorp/consul-template | ||
OWNER := $(dir $(PROJECT)) | ||
OWNER := $(notdir $(OWNER:/=)) | ||
NAME := $(notdir $(PROJECT)) | ||
EXTERNAL_TOOLS = | ||
|
||
# Current system information (this is the invoking system) | ||
ME_OS = $(shell go env GOOS) | ||
ME_ARCH = $(shell go env GOARCH) | ||
|
||
# Default os-arch combination to build | ||
XC_OS ?= linux | ||
XC_ARCH ?= amd64 | ||
XC_EXCLUDE ?= | ||
|
||
# GPG Signing key (blank by default, means no GPG signing) | ||
GPG_KEY ?= | ||
|
||
# List of tests to run | ||
TEST ?= ./... | ||
|
||
# List all our actual files, excluding vendor | ||
GOFILES = $(shell go list $(TEST) | grep -v /vendor/) | ||
|
||
# bin builds the project by invoking the compile script inside of a Docker | ||
# container. Invokers can override the target OS or architecture using | ||
# environment variables. | ||
bin: | ||
@echo "==> Building ${PROJECT}..." | ||
@docker run \ | ||
--rm \ | ||
--env="VERSION=${VERSION}" \ | ||
--env="PROJECT=${PROJECT}" \ | ||
--env="OWNER=${OWNER}" \ | ||
--env="NAME=${NAME}" \ | ||
--env="XC_OS=${XC_OS}" \ | ||
--env="XC_ARCH=${XC_ARCH}" \ | ||
--env="XC_EXCLUDE=${XC_EXCLUDE}" \ | ||
--env="DIST=${DIST}" \ | ||
--workdir="/go/src/${PROJECT}" \ | ||
--volume="${CURRENT_DIR}:/go/src/${PROJECT}" \ | ||
"golang:${GOVERSION}" /usr/bin/env sh -c "scripts/compile.sh" | ||
|
||
# bin-local builds the project using the local go environment. This is only | ||
# recommended for advanced users or users who do not wish to use the Docker | ||
# build process. | ||
bin-local: | ||
@echo "==> Building ${PROJECT} (locally)..." | ||
@env \ | ||
VERSION="${VERSION}" \ | ||
PROJECT="${PROJECT}" \ | ||
OWNER="${OWNER}" \ | ||
NAME="${NAME}" \ | ||
XC_OS="${XC_OS}" \ | ||
XC_ARCH="${XC_ARCH}" \ | ||
XC_EXCLUDE="${XC_EXCLUDE}" \ | ||
DIST="${DIST}" \ | ||
/usr/bin/env sh -c "scripts/compile.sh" | ||
|
||
# bootstrap installs the necessary go tools for development or build | ||
bootstrap: | ||
@echo "==> Bootstrapping ${PROJECT}..." | ||
@for t in ${EXTERNAL_TOOLS}; do \ | ||
echo "--> Installing "$$t"..." ; \ | ||
go get -u "$$t"; \ | ||
done | ||
|
||
# deps gets all the dependencies for this repository and vendors them. | ||
deps: | ||
@echo "==> Updating dependencies..." | ||
@echo "--> Installing dependency manager..." | ||
@go get -u github.com/kardianos/govendor | ||
@govendor init | ||
@echo "--> Installing all dependencies..." | ||
@govendor fetch -v +outside | ||
|
||
# dev builds the project for the current system as defined by go env. | ||
dev: | ||
@env \ | ||
XC_OS="${ME_OS}" \ | ||
XC_ARCH="${ME_ARCH}" \ | ||
$(MAKE) -f "${MKFILE_PATH}" bin | ||
@echo "--> Moving into bin/" | ||
@mkdir -p "${CURRENT_DIR}/bin/" | ||
@cp "${CURRENT_DIR}/pkg/${ME_OS}_${ME_ARCH}/${NAME}" "${CURRENT_DIR}/bin/" | ||
ifdef GOPATH | ||
@echo "--> Moving into GOPATH/" | ||
@mkdir -p "${GOPATH}/bin/" | ||
@cp "${CURRENT_DIR}/pkg/${ME_OS}_${ME_ARCH}/${NAME}" "${GOPATH}/bin/" | ||
endif | ||
|
||
# dist builds the binaries and then signs and packages them for distribution | ||
dist: | ||
@${MAKE} -f "${MKFILE_PATH}" bin DIST=1 | ||
@echo "==> Tagging release (v${VERSION})..." | ||
ifdef GPG_KEY | ||
@git commit --allow-empty --gpg-sign="${GPG_KEY}" -m "Release v${VERSION}" | ||
@git tag -a -m "Version ${VERSION}" -s -u "${GPG_KEY}" "v${VERSION}" master | ||
@gpg --default-key "${GPG_KEY}" --detach-sig "${CURRENT_DIR}/pkg/dist/${NAME}_${VERSION}_SHA256SUMS" | ||
else | ||
@git commit --allow-empty -m "Release v${VERSION}" | ||
@git tag -a -m "Version ${VERSION}" "v${VERSION}" master | ||
endif | ||
|
||
# test runs the test suite | ||
test: | ||
@echo "==> Testing ${PROJECT}..." | ||
@go test -timeout=60s -parallel=10 ${GOFILES} ${TESTARGS} | ||
|
||
# test-race runs the race checker | ||
test-race: | ||
@echo "==> Testing ${PROJECT} (race)..." | ||
@go test -timeout=60s -race ${GOFILES} ${TESTARGS} | ||
|
||
.PHONY: bin bin-local bootstrap deps dev dist test test-race | ||
|
Oops, something went wrong.