From 314d243786437fdd87c76286a8114bc10712e606 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Thu, 31 Jul 2014 11:42:00 +0530 Subject: [PATCH] add more options to bench init --- bench/cli.py | 10 ++++++++-- bench/utils.py | 16 +++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index 0710dbc1..5513da19 100644 --- a/bench/cli.py +++ b/bench/cli.py @@ -39,9 +39,15 @@ def bench(bench='.'): @click.command() @click.argument('path') @click.option('--apps_path', default=None, help="path to json files with apps to install after init") -def init(path, apps_path): +@click.option('--frappe-path', default=None, help="path to frappe repo") +@click.option('--no-procfile', flag_value=True, type=bool, help="Pull changes in all the apps in bench") +@click.option('--no-backups',flag_value=True, type=bool, help="Run migrations for all sites in the bench") +@click.option('--no-auto-update',flag_value=True, type=bool, help="Build JS and CSS artifacts for the bench") +def init(path, apps_path, frappe_path, no_procfile, no_backups, + no_auto_update): "Create a new bench" - _init(path, apps_path=apps_path) + _init(path, apps_path=apps_path, no_procfile=no_procfile, no_backups=no_backups, + no_auto_update=no_auto_update, frappe_path=frappe_path) click.echo('Bench {} initialized'.format(path)) @click.command('get-app') diff --git a/bench/utils.py b/bench/utils.py index 8351f773..1e134019 100644 --- a/bench/utils.py +++ b/bench/utils.py @@ -24,7 +24,8 @@ def get_frappe(bench='.'): print 'bench get-app frappe https://github.com/frappe/frappe.git' return frappe -def init(path, apps_path=None): +def init(path, apps_path=None, no_procfile=False, no_backups=False, + no_auto_update=False, frappe_path=None): from .app import get_app, install_apps_from_path if os.path.exists(path): print 'Directory {} already exists!'.format(path) @@ -38,10 +39,15 @@ def init(path, apps_path=None): setup_env(bench=path) put_config(default_config, bench=path) - get_app('frappe', 'https://github.com/frappe/frappe.git', bench=path) - setup_procfile(bench=path) - setup_backups(bench=path) - setup_auto_update(bench=path) + if not frappe_path: + frappe_path = 'https://github.com/frappe/frappe.git' + get_app('frappe', frappe_path, bench=path) + if not no_procfile: + setup_procfile(bench=path) + if not no_backups: + setup_backups(bench=path) + if not no_auto_update: + setup_auto_update(bench=path) if apps_path: install_apps_from_path(apps_path, bench=path)