From 9fb167ce499a8dc0f687e33c0e68818e7a9c0681 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 13 Aug 2017 16:08:38 +0200 Subject: upgraded to 0.1.3 --- Dockerfile | 17 +++++++++++++++++ Makefile | 9 +++++++-- README.md | 11 ++++++----- main.go | 2 +- 4 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7064b2f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM debian:jessie + +RUN apt-get update + +RUN apt-get install -y curl + +ENV VANITY_URL https://github.com/xiam/vanity/releases/download/v0.1.1/vanity_linux_amd64.gz + +RUN curl --silent -L ${VANITY_URL} | gzip -d > /bin/vanity + +RUN chmod +x /bin/vanity + +RUN mkdir -p /var/run/vanity + +EXPOSE 8080 + +ENTRYPOINT ["/bin/vanity"] diff --git a/Makefile b/Makefile index 9cf51a6..dc1116a 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,9 @@ GOX_OUTPUT_DIR ?= bin GH_ACCESS_TOKEN ?= Missing access token. MESSAGE ?= Latest release. -all: clean +all: build + +build: clean @mkdir -p $(GOX_OUTPUT_DIR) && \ gox -osarch=$(GOX_OSARCH) -output "$(GOX_OUTPUT_DIR)/{{.Dir}}_{{.OS}}_{{.Arch}}" && \ gzip bin/vanity_darwin_* && \ @@ -14,7 +16,7 @@ all: clean require-version: @if [[ -z "$$VERSION" ]]; then echo "Missing \$$VERSION"; exit 1; fi -release: require-version +release: build require-version @RESP=$$(curl --silent --data '{ \ "tag_name": "v$(VERSION)", \ "name": "v$(VERSION)", \ @@ -36,3 +38,6 @@ release: require-version clean: @rm -rf $(GOX_OUTPUT_DIR) + +docker: + docker build -t xiam/vanity . diff --git a/README.md b/README.md index 6f2f3a2..34aaaa2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # vanity -Use `vanity` to provide pretty package names using your own custom domain: +Use `vanity` to provide pretty package import names using your own custom +domain: ```go import ( @@ -10,7 +11,7 @@ import ( ## A simple example -Let's see the available parameters: +See the available `vanity` parameters with `-h`: ``` vanity -h @@ -69,7 +70,7 @@ Hello, Go examples! ### Versioning support `vanity` also comes with versioning support from the original -[http://gopkg.in](http://gopkg.in) with no extra cost. For instance, the +[http://gopkg.in](http://gopkg.in) at no extra cost. For instance, the following import ``` @@ -154,8 +155,8 @@ curl "upper.io/db" -L ... ``` -You'll see some HTML gibberish made for humans, now request it again but this -time using the `go-get=1` parameter (this is what `go get` does): +You'll see some HTML gibberish made for human readers, now request it again but +this time using the `go-get=1` parameter (that is what `go get` does): ``` curl "upper.io/db?go-get=1" -L diff --git a/main.go b/main.go index c935f13..a6c2c77 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ var ( repoRootFlag = flag.String("repo-root", "", "Git repository root URL (e.g.: https://github.com/upper).") ) -var packagePattern = regexp.MustCompile(`^/([a-zA-Z0-9]+)\.?(v[1-9][0-9]*)?(.*)$`) +var packagePattern = regexp.MustCompile(`^/([-a-zA-Z0-9]+)\.?(v[1-9][0-9]*)?(.*)$`) var httpClient = &http.Client{Timeout: 10 * time.Second} -- cgit v1.2.3