Skip to content
Snippets Groups Projects
Commit d5011092 authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Polish the argument of the buildVersion script.

parent c69484df
No related branches found
No related tags found
No related merge requests found
...@@ -107,11 +107,11 @@ def git(): ...@@ -107,11 +107,11 @@ def git():
subprocess.call(cmd) subprocess.call(cmd)
def update(version): def set_version(version):
"""Update version identifier in CHANGELOG and appbase.js """Set version identifier in CHANGELOG and appbase.js
""" """
print 'Modified', JSBASE print 'Set version in', JSBASE
s = open(JSBASE, 'rb').read() s = open(JSBASE, 'rb').read()
# look for a pattern App.version = '0.8.3'; in appbase.js # look for a pattern App.version = '0.8.3'; in appbase.js
...@@ -132,7 +132,7 @@ def update(version): ...@@ -132,7 +132,7 @@ def update(version):
# look for a pattern HEAD in the CHANGELOG # look for a pattern HEAD in the CHANGELOG
# split the the string in 2 parts (pre HEAD, post HEAD) # split the the string in 2 parts (pre HEAD, post HEAD)
print 'Modified', CHANGELOG print 'Set version in', CHANGELOG
s = open(CHANGELOG, 'rb').read() s = open(CHANGELOG, 'rb').read()
m = re.match("(.+HEAD\n)(.*)", s, re.DOTALL) m = re.match("(.+HEAD\n)(.*)", s, re.DOTALL)
...@@ -201,10 +201,15 @@ if __name__ == '__main__': ...@@ -201,10 +201,15 @@ if __name__ == '__main__':
action="store_true", action="store_true",
dest= "git", dest= "git",
help= "run the git steps.") help= "run the git steps.")
ops.add_option("-r", "--release",
action="store_true",
dest= "get",
help= "run the version of the current release and exit.")
ops.add_option("-u", "--update", ops.add_option("-s", "--set_version",
action="store_true", action="store_true",
dest= "update", dest= "set",
help= "run the update version step.") help= "run the update version step.")
ops.add_option("-y", "--yuicompressor", ops.add_option("-y", "--yuicompressor",
...@@ -218,16 +223,23 @@ if __name__ == '__main__': ...@@ -218,16 +223,23 @@ if __name__ == '__main__':
help= "run the web2py step.") help= "run the web2py step.")
ops.set_defaults(clean=False, ops.set_defaults(clean=False,
get=False,
git=False, git=False,
update=False, set=False,
yuicompressor=False, yuicompressor=False,
web2py=False) web2py=False)
(opt, args) = ops.parse_args() (opt, args) = ops.parse_args()
# the version of the current release
if opt.get:
version = get_version()
print "\nThe version of the current release is %s\n" % version
sys.exit(0)
# by default run all steps: update, git, YUIcompressor and web2py # by default run all steps: update, git, YUIcompressor and web2py
if not (opt.update or opt.git or opt.yuicompressor or opt.web2py): if not (opt.set or opt.git or opt.yuicompressor or opt.web2py):
opt.update = True opt.set = True
opt.git = True opt.git = True
opt.yuicompressor = True opt.yuicompressor = True
opt.web2py = True opt.web2py = True
...@@ -239,14 +251,14 @@ if __name__ == '__main__': ...@@ -239,14 +251,14 @@ if __name__ == '__main__':
clean() clean()
sys.exit(0) sys.exit(0)
if opt.update: if opt.set:
if args: if args:
version = args[0] version = args[0]
else: else:
version = raw_input('Enter the version identifier: ') version = raw_input('Enter the version identifier: ')
update(version) set_version(version)
if opt.yuicompressor: yuicompressor() if opt.yuicompressor: yuicompressor()
if opt.git: git() if opt.git: git()
......
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