From cd0ae124bcfe350c06ca6f287476002c03b53213 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 28 Nov 2013 09:57:14 +0530 Subject: [PATCH] [minor] started versioning --- webnotes/__init__.py | 1 + wnf.py | 46 ++++++++++---------------------------------- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/webnotes/__init__.py b/webnotes/__init__.py index cd3531ad66..6519fe0317 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -638,3 +638,4 @@ def validate_versions(): if not spec.match(framework_version): raise Exception, "Framework version out of sync" +validate_versions() diff --git a/wnf.py b/wnf.py index 7942b4e04b..45d04278a4 100755 --- a/wnf.py +++ b/wnf.py @@ -738,16 +738,6 @@ def update_site_config(site_config, site, verbose=False): @cmd def bump(repo, bump_type): - import json - assert repo in ['lib', 'app'] - assert bump_type in ['minor', 'major', 'patch'] - - def validate(repo_path): - import git - repo = git.Repo(repo_path) - if repo.active_branch != 'master': - raise Exception, "Current branch not master in {}".format(repo_path) - def bump_version(version, version_type): import semantic_version v = semantic_version.Version(version) @@ -758,45 +748,29 @@ def bump(repo, bump_type): elif version_type == 'patch': v.patch += 1 return unicode(v) + + + assert repo in ['lib', 'app'] + assert bump_type in ['minor', 'major', 'patch'] def add_tag(repo_path, version): import git repo = git.Repo(repo_path) - repo.index.add(['config.json']) - repo.index.commit('bumped to version {}'.format(version)) repo.create_tag('v' + version, repo.head) - - def update_framework_requirement(version): - with open('app/config.json') as f: - config = json.load(f) - config['requires_framework_version'] = '==' + version - with open('app/config.json', 'w') as f: - json.dump(config, f, indent=1, sort_keys=True) - - validate('lib/') - validate('app/') if repo == 'app': with open('app/config.json') as f: config = json.load(f) - new_version = bump_version(config['app_version'], bump_type) - config['app_version'] = new_version - with open('app/config.json', 'w') as f: - json.dump(config, f, indent=1, sort_keys=True) - add_tag('app/', new_version) + new_version = bump_version(config['app_version'], bump_type) + config['app_version'] = new_version + json.dump(config, f) elif repo == 'lib': with open('lib/config.json') as f: config = json.load(f) - new_version = bump_version(config['framework_version'], bump_type) - config['framework_version'] = new_version - with open('lib/config.json', 'w') as f: - json.dump(config, f, indent=1, sort_keys=True) - add_tag('lib/', new_version) - - update_framework_requirement(new_version) - - bump('app', bump_type) + new_version = bump_version(config['framework_version'], bump_type) + config['framework_version'] = new_version + json.dump(config, f) if __name__=="__main__":