Skip to content

Commit af8067a

Browse files
committed
Release includes up to date man page.
1 parent 0696416 commit af8067a

File tree

3 files changed

+74
-20
lines changed

3 files changed

+74
-20
lines changed

CONTRIBUTING_CODE.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
Be aware that bash_unit version information is extracted from git tags.
2-
If you need to deliver a versionned copy of bash_unit, you will have to
3-
activate the appropriate filters so that version information is up to
4-
date.
1+
To perform a new release, run ./release in current directory.
52

6-
To do so, run the following command on your system :
7-
8-
$> git config --local include.path ../.gitconfig
3+
See help for more informations.

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ifndef::backend-manpage[]
88
image::img/bu_50.png[bash_unit]
99
endif::[]
1010

11-
*bash_unit* - bash unit testing enterprise edition framework for professionals !
11+
bash_unit - bash unit testing enterprise edition framework for professionals !
1212

1313
== Synopsis
1414

release

Lines changed: 71 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,72 @@
22

33
token_file=token
44

5+
cd $(dirname $0)
6+
7+
check_can_release() {
8+
local version="$1"
9+
10+
which asciidoctor >/dev/null 2>&1 || usage "You need asciidoctor to make releases"
11+
12+
if [ ! -z "$(git status --porcelain)" ]
13+
then
14+
git status >&2
15+
echo >&2
16+
usage "Please commit your pending changes first"
17+
fi
18+
19+
[[ -z $version ]] && usage "No version specified on command line"
20+
echo $version | grep -E '^v[0-9]*\.[0-9]*\.[0-9]*$' >/dev/null || usage "Invalid format for version: $version"
21+
[ -r $token_file ] || usage "$token_file file does not exist"
22+
23+
source $token_file
24+
25+
[[ -z $user ]] && usage "user not found in file $token_file"
26+
[[ -z $token ]] && usage "token not found in file $token_file"
27+
true #avoid error on last instruction of function (see bash -e)
28+
}
29+
30+
prepare_release() {
31+
set -x
32+
local version="$1"
33+
shift
34+
35+
update_version "$version"
36+
update_man
37+
38+
git add bash_unit
39+
git add docs/man/man1/bash_unit.1
40+
41+
if [ $# -eq 0 ]
42+
then
43+
git commit -m "prepare release $version"
44+
else
45+
git commit -m "$*"
46+
fi
47+
48+
git tag "$version"
49+
}
50+
51+
update_version() {
52+
local version="$1"
53+
sed -i "s:^VERSION=.*:VERSION=$version:" bash_unit
54+
}
55+
56+
update_man() {
57+
asciidoctor -D docs/man/man1 -d manpage -b manpage README.adoc
58+
}
59+
60+
publish_release() {
61+
local version="$1"
62+
63+
git push
64+
git push --tags
65+
curl -u $user:$token -XPOST https://api.github.com/repos/pgrange/bash_unit/releases -d "
66+
{
67+
\"tag_name\": \"$version\"
68+
}"
69+
}
70+
571
usage() {
672
local message=$1
773

@@ -22,18 +88,11 @@ EOF
2288
exit 1
2389
}
2490

91+
[[ $# -ge 1 ]] || usage "You must specify version on command line"
2592
version=$1
93+
shift
2694

27-
[[ -z $version ]] && usage "No version specified on command line"
28-
echo $version | grep -E '^v[0-9]*\.[0-9]*\.[0-9]*$' >/dev/null || usage "Invalid format for version: $version"
29-
[ -r $token_file ] || usage "$token_file file does not exist"
30-
31-
source $token_file
32-
33-
[[ -z $user ]] && usage "user not found in file $token_file"
34-
[[ -z $token ]] && usage "token not found in file $token_file"
95+
check_can_release "$version"
3596

36-
curl -u $user:$token -XPOST https://api.github.com/repos/pgrange/bash_unit/releases -d "
37-
{
38-
\"tag_name\": \"$version\"
39-
}"
97+
prepare_release "$version" "$@"
98+
publish_release "$version"

0 commit comments

Comments
 (0)