2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-23 04:29:02 +00:00

add more options to bench init

This commit is contained in:
Pratik Vyas 2014-07-31 11:42:00 +05:30
parent e8965c0f3f
commit 314d243786
2 changed files with 19 additions and 7 deletions

View File

@ -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')

View File

@ -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)