Skip to content

Commit

Permalink
Add built-date to version command (#636)
Browse files Browse the repository at this point in the history
* Add built-date to version command
* Update makefile to avoid parse date and revision from bin
* Force UTC timezone for date command
  • Loading branch information
desyncr authored Dec 31, 2017
1 parent 7bce2cc commit 6aa7016
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ build:
@echo "-antigen-env-setup" >> ${TARGET}
@echo "${VERSION}" > ${VERSION_FILE}
@$(call ised,"s/{{ANTIGEN_VERSION}}/$$(cat ${VERSION_FILE})/",${TARGET})
@$(call ised,"s/{{ANTIGEN_REVISION}}/$$(git log -n1 --format=%h -- . ':(exclude)bin')/",${TARGET})
@$(call ised,"s/{{ANTIGEN_REVISION_DATE}}/$$(TZ=UTC date -d @$$(git log -n1 --format='%at' -- . ':(exclude)bin') '+%F %T %z')/",${TARGET})
ifeq (${WITH_DEBUG}, no)
@$(call isede,"s/ (WARN|LOG|ERR|TRACE) .*&//",${TARGET})
@$(call isede,"/ (WARN|LOG|ERR|TRACE) .*/d",${TARGET})
Expand Down
2 changes: 2 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ build:
@echo "-antigen-env-setup" >> ${TARGET}
@echo "${VERSION}" > ${VERSION_FILE}
@$(call ised,"s/{{ANTIGEN_VERSION}}/$$(cat ${VERSION_FILE})/",${TARGET})
@$(call ised,"s/{{ANTIGEN_REVISION}}/$$(git log -n1 --format=%h -- . ':(exclude)bin')/",${TARGET})
@$(call ised,"s/{{ANTIGEN_REVISION_DATE}}/$$(TZ=UTC date -d @$$(git log -n1 --format='%at' -- . ':(exclude)bin') '+%F %T %z')/",${TARGET})
ifeq (${WITH_DEBUG}, no)
@$(call isede,"s/ (WARN|LOG|ERR|TRACE) .*&//",${TARGET})
@$(call isede,"/ (WARN|LOG|ERR|TRACE) .*/d",${TARGET})
Expand Down
10 changes: 4 additions & 6 deletions bin/antigen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -1383,13 +1383,11 @@ antigen-use () {
fi
}
antigen-version () {
local version="develop"
local extensions revision=""
if [[ -d $_ANTIGEN_INSTALL_DIR/.git ]]; then
revision=" ($(git --git-dir=$_ANTIGEN_INSTALL_DIR/.git rev-parse --short '@'))"
fi
local extensions

printf "Antigen %s (%s)\nRevision date: %s\n" "develop" "2f87993" "2017-12-31 02:09:55 +0000"

printf "Antigen %s%s\n" $version $revision
# Show extension information if any is available
if (( $+functions[antigen-ext] )); then
typeset -a extensions; extensions=($(antigen-ext-list))
if [[ $#extensions -gt 0 ]]; then
Expand Down
10 changes: 4 additions & 6 deletions src/commands/version.zsh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
antigen-version () {
local version="{{ANTIGEN_VERSION}}"
local extensions revision=""
if [[ -d $_ANTIGEN_INSTALL_DIR/.git ]]; then
revision=" ($(git --git-dir=$_ANTIGEN_INSTALL_DIR/.git rev-parse --short '@'))"
fi
local extensions

printf "Antigen %s (%s)\nRevision date: %s\n" "{{ANTIGEN_VERSION}}" "{{ANTIGEN_REVISION}}" "{{ANTIGEN_REVISION_DATE}}"

printf "Antigen %s%s\n" $version $revision
# Show extension information if any is available
if (( $+functions[antigen-ext] )); then
typeset -a extensions; extensions=($(antigen-ext-list))
if [[ $#extensions -gt 0 ]]; then
Expand Down
2 changes: 2 additions & 0 deletions tests/version.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Antigen version command.

$ antigen-version
Antigen * (glob)
Revision date: * (glob)

$ antigen version
Antigen * (glob)
Revision date: * (glob)

0 comments on commit 6aa7016

Please sign in to comment.