Skip to content
Snippets Groups Projects
Commit d3abcc19 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Merge branch '1-branching-model' into 'master'

1 branching model

* Reopen the branch 1-branching-model and the corresponding issue.
* The issue #1 has been closed to soon since the script ``build_version.py`` has to be adapted to the imporved branching model.
* This is performad by this merge request
* Closes #1.

See merge request !2
parents ea0eb569 4854d9a7
No related branches found
No related tags found
1 merge request!4Release 0.6.5
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
"""
NAME
build_version -- helper script to build and tag a plugin_dbui version
build_version -- helper script to build a plugin_dbui version
SYNOPSIS
build_version [options] version
......@@ -16,7 +16,6 @@
Push version identifier in the javascript library.
Push version number in the CHANGELOG.
Build debug and minified version of the javascript library.
Commit the new version in git and tag it
Build the web2py plugin file
EXAMPLES
......@@ -57,6 +56,7 @@ JSLIBDEBUG = 'static/plugin_dbui/dbui-debug.js'
JSLIBMIN = 'static/plugin_dbui/dbui-min.js'
JSLIBSRC = 'static/plugin_dbui/src'
LATEX = 'latex'
LATEXDOC = opj(DOCS, LATEX)
NOW = datetime.datetime.now()
PACK_PLUGIN_URL = 'http://localhost:8000/%s/default/pack_plugin' % APP
PDF = "pdf"
......@@ -118,16 +118,14 @@ def build_pdf(doc):
"""
print "Build the PDF documentations..."
latexdoc = opj(DOCS, LATEX)
# generate the latex
sphinx("-b latex", opj(DOCSRC, doc), latexdoc)
sphinx("-b latex", opj(DOCSRC, doc), LATEXDOC)
# the current directory
cwd = os.getcwd()
# find the name of the tex file
os.chdir(latexdoc)
os.chdir(LATEXDOC)
li = [el for el in os.listdir('.') if el.endswith('.tex')]
fn = (li[0] if len(li) == 1 else None)
......@@ -141,22 +139,20 @@ def build_pdf(doc):
# move the pdf file
os.chdir(cwd)
pdfdir = opj(DOCS, PDF)
if not os.path.exists(pdfdir):
os.mkdir(pdfdir)
if not os.path.exists(PDFDOC):
os.mkdir(PDFDOC)
fin = fn.replace('.tex', '.pdf')
fout = "%s_%s.pdf" % (os.path.splitext(fn)[0], doc)
os.rename(opj(latexdoc, fin), opj(pdfdir, fout))
os.rename(opj(LATEXDOC, fin), opj(PDFDOC, fout))
# remove the latex directory
call(["rm", "-rf", latexdoc])
call(["rm", "-rf", LATEXDOC])
print "PDF documentation in", PDFDOC
print "%s documentation in" % fout, PDFDOC
def change_log():
def commit_change_log():
"""Commit CHANGELOG and App.js.
"""
......@@ -166,106 +162,18 @@ def change_log():
print '\tSkip this step.\n'
return
# move to the master branch
git("checkout master")
# Commit modified files
print 'git add', JSBASE, CHANGELOG
git("add", JSBASE, CHANGELOG)
print 'git commit'
msg = "Start release cycle %s" % get_version()
msg = "Start release candidate %s" % get_version()
git("commit -m", msg)
def close_feature():
"""Close the feature cycle.
"""
print "Close the feature cycle..."
print "Current branches are:"
git("branch")
rep = raw_input("Select the feature identifier:")
if not rep:
sys.exit(0)
branch = "feature-%s" % rep
git("checkout develop")
git("merge --no-ff", branch)
rep = raw_input("Delete the locale branch %s [y/N]", branch)
if rep == 'y':
git("branch -d", branch)
def close_hotfix():
"""Close the hotfix cycle.
"""
print "Close the hotfix cycle..."
print "Current branches are:"
git("branch")
release = raw_input("Select the hotfix identifier:")
if not release:
sys.exit(0)
branch = "hotfix-%s" % release
git("checkout master")
git("merge --no-ff", branch)
msg = "Release %s" % release
git("tag -a", release, "-m", msg)
git("checkout develop")
git("merge --no-ff", branch)
rep = raw_input("Delete branch %s [y/N]:" % branch)
if rep == "y":
git("branch -d", branch)
git("checkout master")
build()
web2py()
print "The hotfix cycle ", release, "is over"
def close_release():
"""Close the release cycle.
"""
print "Close the release cycle..."
print "Current branches are:"
git("branch")
release = raw_input("Select the release identifier:")
if not release:
sys.exit(0)
branch = "release-%s" % release
msg = "Release %s" % release
print msg
git("checkout develop")
git("merge --no-ff", branch, "-m", msg)
git("checkout master")
git("merge --no-ff", branch, "-m", msg)
git("tag -a", release, "-m", msg)
rep = raw_input("Delete branch %s [y/N]:" % branch)
if rep == "y":
git("branch -d", branch)
build()
web2py()
print "The release cycle ", release, "is over"
def compile_js():
"""compile_js the javascript code and generate the debug version
as well as the minified version of the dbui library.
......@@ -486,41 +394,12 @@ def sphinx(*args, **kwargs):
call(cmd, **kwargs)
def start_feature():
"""Start the feature cycle.
"""
print "Start the feature cycle..."
rep = raw_input("Enter the feature identifier:")
if not rep:
sys.exit(0)
branch = "feature-%s" % rep
git("checkout -b", branch, "develop")
def start_hotfix():
"""Start the hotfix cycle.
"""
print "Start the hotfix cycle..."
print "The current release is", get_version()
rep = raw_input("Enter the hotfix release identifer:")
if not rep:
sys.exit(0)
branch = "hotfix-%s" % rep
git("checkout -b", branch, "master")
set_version(rep)
change_log()
def start_release():
"""Start the release cycle.
Set the new release number in the CHANGELOG and App.js files.
Commit then in the master branch.
"""
print "Start the release cycle..."
......@@ -535,21 +414,24 @@ def start_release():
git("checkout", "-b", branch, "develop")
set_version(new_release)
change_log()
commit_change_log()
build()
def tag():
"""Tag the current release in git.
"""Tag the release in the production branch.
"""
print "Tag the release...",
version = get_version()
msg = "Tag %s" % version
# move to production branch
git("checkout", "production")
# annotated tag
version = get_version()
print 'git tag', version
msg = "Tag %s" % version
git("tag", "-a", version, "-m", msg)
......@@ -593,41 +475,11 @@ if __name__ == '__main__':
dest="api_doc",
help="build the API documentation in HTML.")
OPS.add_option("--api-pdf",
OPS.add_option("-A", "--api-pdf",
action="store_true",
dest="api_pdf",
help="build the API documentation in PDF.")
OPS.add_option("--start-feature",
action="store_true",
dest="start_feature",
help="start the feature cycle.")
OPS.add_option("--start-hotfix",
action="store_true",
dest="start_hotfix",
help="start the hotfix cycle.")
OPS.add_option("--start-release",
action="store_true",
dest="start_release",
help="start the new release branch cycle.")
OPS.add_option("--close-hotfix",
action="store_true",
dest="close_hotfix",
help="close the hotfix branch cycle.")
OPS.add_option("--close-feature",
action="store_true",
dest="close_feature",
help="close the feature branch cycle.")
OPS.add_option("--close-release",
action="store_true",
dest="close_release",
help="close the release branch cycle.")
OPS.add_option("-c", "--compile",
action="store_true",
dest="compile",
......@@ -636,7 +488,8 @@ if __name__ == '__main__':
OPS.add_option("--commit-changelog",
action="store_true",
dest="changelog",
help="commit CHANGELOG and App.js.")
help="commit CHANGELOG and App.js. "
"To be used with --write-release.")
OPS.add_option("-j", "--jsduck",
action="store_true",
......@@ -648,27 +501,31 @@ if __name__ == '__main__':
dest="reference_doc",
help="build the reference manual in HTML.")
OPS.add_option("--reference-pdf",
OPS.add_option("-R", "--reference-pdf",
action="store_true",
dest="reference_pdf",
help="build the reference manual in PDF.")
OPS.add_option("--write-release",
OPS.add_option("-s", "--start-release",
action="store_true",
dest="release",
help="write the release number in CHANGELOG and App.js.")
dest="start_release",
help="start the release candidate by setting "
"release number in change log and App.js. "
"Commit changes in the master branch. "
"Equivalent to --write-release followed by "
"--commit-changelog.")
OPS.add_option("--tag",
OPS.add_option("-t", "--tag",
action="store_true",
dest="tag",
help="tag the release in git.")
help="tag the release in the production branch.")
OPS.add_option("-u", "--user-doc",
action="store_true",
dest="user_doc",
help="build the user manual in HTML.")
OPS.add_option("--user-pdf",
OPS.add_option("-U", "--user-pdf",
action="store_true",
dest="user_pdf",
help="build the user manual in PDF.")
......@@ -681,21 +538,23 @@ if __name__ == '__main__':
OPS.add_option("-w", "--web2py",
action="store_true",
dest="web2py",
help="pack the web2py plugin.")
help="pack the plugin_dbui.")
OPS.add_option("--write-release",
action="store_true",
dest="release",
help="write the release number in CHANGELOG and App.js. "
"To be used with --commit-changelog.")
OPS.set_defaults(api_doc=False,
api_pdf=False,
close_feature=False,
close_hotfix=False,
close_release=False,
changelog=False,
compile=False,
jsduck=False,
reference_doc=False,
reference_pdf=False,
release=False,
start_feature=False,
start_hotfix=False,
start_release=False,
tag=False,
user_doc=False,
......@@ -710,20 +569,11 @@ if __name__ == '__main__':
if OPT.api_pdf:
build_pdf(API)
if OPT.close_feature:
close_feature()
if OPT.close_hotfix:
close_hotfix()
if OPT.close_release:
close_release()
if OPT.compile:
compile_js()
if OPT.changelog:
change_log()
commit_change_log()
if OPT.jsduck:
jsduck()
......@@ -737,15 +587,12 @@ if __name__ == '__main__':
if OPT.reference_pdf:
build_pdf(REFERENCE)
if OPT.start_feature:
start_feature()
if OPT.start_hotfix:
start_hotfix()
if OPT.start_release:
start_release()
if OPT.tag:
tag()
if OPT.user_doc:
sphinx("-b html", opj(DOCSRC, USER), opj(DOCS, USER))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment