From 252b1ed8b665c1c46247328572902a5e3a6bebbc Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Thu, 21 Nov 2013 00:01:38 +0000 Subject: [PATCH 1/3] Add a version command. The git tag/revision is saved when running "make install", and can be displayed using "dokku version". --- Makefile | 8 ++++++-- plugins/00_dokku-standard/commands | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 69fcec755..e8415bdda 100644 --- a/Makefile +++ b/Makefile @@ -2,19 +2,23 @@ SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb STACK_URL ?= github.com/progrium/buildstep PREBUILT_STACK_URL ?= https://s3.amazonaws.com/progrium-dokku/progrium_buildstep_79cf6805cf.tgz +DOKKU_ROOT ?= /home/dokku -.PHONY: all install copyfiles plugins dependencies sshcommand pluginhook docker aufs stack count +.PHONY: all install copyfiles version plugins dependencies sshcommand pluginhook docker aufs stack count all: # Type "make install" to install. -install: dependencies stack copyfiles plugins +install: dependencies stack copyfiles plugins version copyfiles: cp dokku /usr/local/bin/dokku mkdir -p /var/lib/dokku/plugins cp -r plugins/* /var/lib/dokku/plugins +version: + git describe --tags > ${DOKKU_ROOT}/VERSION + plugins: pluginhook docker dokku plugins-install diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 7a7252a20..5dd309c57 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -66,12 +66,20 @@ case "$1" in fi ;; + version) + cat "$DOKKU_ROOT/VERSION" || { + echo "Unable to determine dokku's version" 2>&1 + exit 1 + } + ;; + help) cat && cat< Delete an application logs [-t] Show the last logs for an application (-t follows) run Run a command in the environment of an application url Show the URL for an application + version Print dokku's version EOF ;; From 725a2e02dafeac7a521cdd5cbdf9dd3250457645 Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Thu, 21 Nov 2013 00:15:22 +0000 Subject: [PATCH 2/3] Use a hardcoded version if git revision is not available. --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e8415bdda..d47cf82c2 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +DOKKU_VERSION = master + SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb STACK_URL ?= github.com/progrium/buildstep @@ -17,7 +19,7 @@ copyfiles: cp -r plugins/* /var/lib/dokku/plugins version: - git describe --tags > ${DOKKU_ROOT}/VERSION + git describe --tags > ${DOKKU_ROOT}/VERSION 2> /dev/null || echo '~${DOKKU_VERSION}' > ${DOKKU_ROOT}/VERSION plugins: pluginhook docker dokku plugins-install From 4bc45256ffca5de9b782c3a3c3e59cdf3d823f46 Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Thu, 21 Nov 2013 00:41:03 +0000 Subject: [PATCH 3/3] Add the date and time of installation if version is hardcoded. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d47cf82c2..a30252443 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ copyfiles: cp -r plugins/* /var/lib/dokku/plugins version: - git describe --tags > ${DOKKU_ROOT}/VERSION 2> /dev/null || echo '~${DOKKU_VERSION}' > ${DOKKU_ROOT}/VERSION + git describe --tags > ${DOKKU_ROOT}/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ${DOKKU_ROOT}/VERSION plugins: pluginhook docker dokku plugins-install