Skip to content

Commit

Permalink
Add tag task to internal fabfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed May 2, 2009
1 parent ee5e7fb commit 713ea7b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions fabfile.py
Expand Up @@ -2,8 +2,11 @@
Fabric's own fabfile.
"""

from __future__ import with_statement

from fabric.api import *
from fabric.contrib import rsync_project
import fabric.version


def test():
Expand All @@ -24,5 +27,44 @@ def build_docs():

@hosts('jforcier@fabfile.org')
def push_docs():
"""
Build and push the Sphinx docs to docs.fabfile.org
"""
build_docs()
rsync_project('/var/www/docs.fabfile/', 'docs/_build/html/', delete=True)


def tag():
"""
Tag a new release of the software
"""
with warnings_only():
# Get current version string
version = fabric.version.get_version()
# Does that tag already exist?
exists = local("git tag | grep %s" % version)
if exists:
# If no work has been done since, what's the point?
if not local("git log %s.." % version):
abort("No work done since last tag!")
# If work *has* been done since, we need to make a new tag. To the
# editor for version update!
raw_input("Work has been done since last tag, version update is needed. Hit Enter to load version info in your editor: ")
local("$EDITOR fabric/version.py", capture=False)
# Reload version module to get new version
reload(fabric.version)
# If the tag doesn't exist, the user has already updated version info
# and we can just move on.
else:
print("Version has already been updated, no need to edit...")
# Get version strings
verbose_version = fabric.version.get_version(verbose=True)
short_version = fabric.version.get_version()
# Commit the version update
local("git add fabric/version.py")
local("git commit -m \"Cut %s\"" % verbose_version)
# And tag it
local("git tag -m \"Fabric %s\" %s" % (
verbose_version,
short_version
))

0 comments on commit 713ea7b

Please sign in to comment.