From 3034adb245e473835e7b94dcfe4e35dbd641da2b Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 18 Feb 2011 15:26:42 -0500 Subject: [PATCH] doc: forgot to add doc/git-get-version.sh Signed-off-by: Jean Privat --- .gitignore | 1 + doc/git-gen-version.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100755 doc/git-gen-version.sh diff --git a/.gitignore b/.gitignore index c6bbb96..a4d3ff1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ doc/stdlib *.log *.out *.toc +doc/nit_version.sty src/nitc src/nitc_? diff --git a/doc/git-gen-version.sh b/doc/git-gen-version.sh new file mode 100755 index 0000000..145f2f7 --- /dev/null +++ b/doc/git-gen-version.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2008 Jean Privat +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This program is used to generate version number from git refs. +# The version number is stored in a dedicated Nit module. + +gen_version() { + if ! grep "$*" nit_version.sty >/dev/null 2>&1; then + cat > nit_version.sty</dev/null) +if [ "$?" != "0" ]; then + if [ -r ../VERSION ]; then + VN="$(cat ../VERSION)" + else + echo >&2 "Error: no VERSION file and not a .git repository." + exit 1 + fi +fi +if [ -z "$VN" ]; then + VN="undefined" +fi +if [ -n "$1" ]; then + VN="${VN}-$1" +fi +if [ -n "$(git diff HEAD 2>/dev/null)" ]; then + VN="${VN}-dirty" +fi + +gen_version "$VN" -- 1.7.9.5