Created
December 11, 2013 19:05
-
-
Save canassa/7916413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Runs during git flow hotfix start | |
# | |
# Positional arguments: | |
# $1 Version | |
# | |
# Return VERSION - When VERSION is returned empty, git-flow will stop as the | |
# version is necessary | |
# | |
# The following variables are available as they are exported by git-flow: | |
# | |
# MASTER_BRANCH - The branch defined as Master | |
# DEVELOP_BRANCH - The branch defined as Develop | |
$version = ARGV[0] | |
if $version.nil? | |
last_tag_rev = `git rev-list --tags --max-count=1`.strip | |
last_tag_name = `git describe --tags #{last_tag_rev}`.strip | |
major, minor, hotfix = last_tag_name.split('.').map(&:to_i) | |
$version = "%d.%d.%d" % [major, minor, hotfix + 1] | |
end | |
puts $version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment