Skip to content

Commit ac4bbee

Browse files
committed
support versioning for homebrew tap
1 parent 3b2fd91 commit ac4bbee

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

bake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ function bake_inernal_help () {
313313
echo " init Creates a skeleton Bakefile"
314314
echo " update Updates libraries (see ~/.bake)."
315315
echo " upgrade Refreshes bake itself."
316+
echo " version Show the version of bake!"
316317
}
317318

318319
function bake_sorted_task_list () {
@@ -392,6 +393,10 @@ function bake_upgrade () {
392393
mv $0.new $0
393394
}
394395

396+
function bake_version () {
397+
echo "$BAKE_VERSION"
398+
}
399+
395400
function bake_update () {
396401
if [ ! -d $HOME/.bake/packages ]; then
397402
bake_echo_yellow "No libraries found in ~/.bake, nothing to upgrade"
@@ -438,6 +443,11 @@ function bake_run () {
438443
local bakefile="$(bake_find_bakefile)"
439444

440445
if [ ! -e "$bakefile" ]; then
446+
if [ "$task" == "version" ]; then
447+
bake_version
448+
return 0
449+
fi
450+
441451
if [ "$task" == "upgrade" ]; then
442452
bake_upgrade
443453
return 0

build/Bakefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22

33
# bake_require github.com/kyleburton/bake-recipes/docker/docker.sh
44

5+
function build::update-version () {
6+
local infname="$1"
7+
local vstring="$2"
8+
9+
sed -i '' "s/^BAKE_VERSION=\".*\"$/BAKE_VERSION=\"$vstring\"/" "$infname"
10+
}
11+
512
function build::curr-git-tag {
6-
local curr_tag="$(git tag -l | sort | head -n 1)"
13+
local curr_tag="$(git tag -l | sort | tail -n 1)"
714
if [ -z "$curr_tag" ]; then
815
echo "1.0.0"
916
fi
@@ -46,6 +53,8 @@ function make-release () {
4653
cp README.md Changes "./release/$relname/"
4754
cp bake bake-completion.sh "./release/$relname/bin"
4855

56+
build::update-version "./release/$relname/bin/bake" "$next_tag"
57+
4958
tar -C ./release -czvf $bundle_name $relname
5059
bake_echo_yellow "TODO: update Changes using the current date + git log using curr ($curr_tag) vs next ($next_tag) tags"
5160
bake_echo_yellow "TODO: automate the process of creating the release in GH: https://help.github.com/articles/creating-releases/"

0 commit comments

Comments
 (0)