mirror of
https://github.com/frappe/bench.git
synced 2025-01-23 15:08:24 +00:00
add bench docs
This commit is contained in:
parent
49707d56b0
commit
0ad9189155
28
bench/cli.py
28
bench/cli.py
@ -28,12 +28,14 @@ def frappe(bench='.'):
|
|||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def bench(bench='.'):
|
def bench(bench='.'):
|
||||||
|
"Bench manager for Frappe"
|
||||||
# TODO add bench path context
|
# TODO add bench path context
|
||||||
setup_logging(bench=bench)
|
setup_logging(bench=bench)
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.argument('path')
|
@click.argument('path')
|
||||||
def init(path):
|
def init(path):
|
||||||
|
"Create a new bench"
|
||||||
_init(path)
|
_init(path)
|
||||||
click.echo('Bench {} initialized'.format(path))
|
click.echo('Bench {} initialized'.format(path))
|
||||||
|
|
||||||
@ -41,26 +43,30 @@ def init(path):
|
|||||||
@click.argument('name')
|
@click.argument('name')
|
||||||
@click.argument('git-url')
|
@click.argument('git-url')
|
||||||
def get_app(name, git_url):
|
def get_app(name, git_url):
|
||||||
|
"clone an app from the internet and set it up in your bench"
|
||||||
_get_app(name, git_url)
|
_get_app(name, git_url)
|
||||||
|
|
||||||
@click.command('new-app')
|
@click.command('new-app')
|
||||||
@click.argument('app-name')
|
@click.argument('app-name')
|
||||||
def new_app(app_name):
|
def new_app(app_name):
|
||||||
|
"start a new app"
|
||||||
_new_app(app_name)
|
_new_app(app_name)
|
||||||
|
|
||||||
@click.command('new-site')
|
@click.command('new-site')
|
||||||
@click.argument('site')
|
@click.argument('site')
|
||||||
def new_site(site):
|
def new_site(site):
|
||||||
|
"Create a new site in the bench"
|
||||||
_new_site(site)
|
_new_site(site)
|
||||||
|
|
||||||
@click.command('update')
|
@click.command('update')
|
||||||
@click.option('--pull', flag_value=True, type=bool)
|
@click.option('--pull', flag_value=True, type=bool, help="Pull changes in all the apps in bench")
|
||||||
@click.option('--patch',flag_value=True, type=bool)
|
@click.option('--patch',flag_value=True, type=bool, help="Run migrations for all sites in the bench")
|
||||||
@click.option('--build',flag_value=True, type=bool)
|
@click.option('--build',flag_value=True, type=bool, help="Build JS and CSS artifacts for the bench")
|
||||||
@click.option('--bench',flag_value=True, type=bool)
|
@click.option('--bench',flag_value=True, type=bool, help="Update bench")
|
||||||
@click.option('--restart-supervisor',flag_value=True, type=bool)
|
@click.option('--restart-supervisor',flag_value=True, type=bool, help="restart supervisor processes after update")
|
||||||
@click.option('--auto',flag_value=True, type=bool)
|
@click.option('--auto',flag_value=True, type=bool)
|
||||||
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False):
|
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False):
|
||||||
|
"Update bench"
|
||||||
if not (pull or patch or build or bench):
|
if not (pull or patch or build or bench):
|
||||||
pull, patch, build, bench = True, True, True, True
|
pull, patch, build, bench = True, True, True, True
|
||||||
|
|
||||||
@ -80,31 +86,38 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
|
|||||||
|
|
||||||
@click.command('restart')
|
@click.command('restart')
|
||||||
def restart():
|
def restart():
|
||||||
|
"Restart supervisor processes"
|
||||||
exec_cmd("sudo supervisorctl restart frappe:")
|
exec_cmd("sudo supervisorctl restart frappe:")
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
@click.group()
|
@click.group()
|
||||||
def setup():
|
def setup():
|
||||||
|
"Setup bench"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@click.command('sudoers')
|
@click.command('sudoers')
|
||||||
def setup_sudoers():
|
def setup_sudoers():
|
||||||
|
"Add commands to sudoers list for execution without password"
|
||||||
_setup_sudoers()
|
_setup_sudoers()
|
||||||
|
|
||||||
@click.command('nginx')
|
@click.command('nginx')
|
||||||
def setup_nginx():
|
def setup_nginx():
|
||||||
|
"generate config for nginx"
|
||||||
generate_config('nginx', 'nginx.conf')
|
generate_config('nginx', 'nginx.conf')
|
||||||
|
|
||||||
@click.command('supervisor')
|
@click.command('supervisor')
|
||||||
def setup_supervisor():
|
def setup_supervisor():
|
||||||
|
"generate config for supervisor"
|
||||||
generate_config('supervisor', 'supervisor.conf')
|
generate_config('supervisor', 'supervisor.conf')
|
||||||
|
|
||||||
@click.command('auto-update')
|
@click.command('auto-update')
|
||||||
def setup_auto_update():
|
def setup_auto_update():
|
||||||
|
"Add cronjob for bench auto update"
|
||||||
_setup_auto_update()
|
_setup_auto_update()
|
||||||
|
|
||||||
@click.command('backups')
|
@click.command('backups')
|
||||||
def setup_backups():
|
def setup_backups():
|
||||||
|
"Add cronjob for bench backups"
|
||||||
_setup_backups()
|
_setup_backups()
|
||||||
|
|
||||||
@click.command('dnsmasq')
|
@click.command('dnsmasq')
|
||||||
@ -113,6 +126,7 @@ def setup_dnsmasq():
|
|||||||
|
|
||||||
@click.command('env')
|
@click.command('env')
|
||||||
def setup_env():
|
def setup_env():
|
||||||
|
"Setup virtualenv for bench"
|
||||||
_setup_env()
|
_setup_env()
|
||||||
|
|
||||||
setup.add_command(setup_nginx)
|
setup.add_command(setup_nginx)
|
||||||
@ -127,23 +141,27 @@ setup.add_command(setup_env)
|
|||||||
## Not DRY
|
## Not DRY
|
||||||
@click.group()
|
@click.group()
|
||||||
def config():
|
def config():
|
||||||
|
"change bench configuration"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@click.command('auto_update')
|
@click.command('auto_update')
|
||||||
@click.argument('state', type=click.Choice(['on', 'off']))
|
@click.argument('state', type=click.Choice(['on', 'off']))
|
||||||
def config_auto_update(state):
|
def config_auto_update(state):
|
||||||
|
"Enable/Disable auto update for bench"
|
||||||
state = True if state == 'on' else False
|
state = True if state == 'on' else False
|
||||||
update_config({'auto_update': state})
|
update_config({'auto_update': state})
|
||||||
|
|
||||||
@click.command('restart_supervisor_on_update')
|
@click.command('restart_supervisor_on_update')
|
||||||
@click.argument('state', type=click.Choice(['on', 'off']))
|
@click.argument('state', type=click.Choice(['on', 'off']))
|
||||||
def config_restart_supervisor_on_update(state):
|
def config_restart_supervisor_on_update(state):
|
||||||
|
"Enable/Disable auto restart of supervisor processes"
|
||||||
state = True if state == 'on' else False
|
state = True if state == 'on' else False
|
||||||
update_config({'restart_supervisor_on_update': state})
|
update_config({'restart_supervisor_on_update': state})
|
||||||
|
|
||||||
@click.command('update_bench_on_update')
|
@click.command('update_bench_on_update')
|
||||||
@click.argument('state', type=click.Choice(['on', 'off']))
|
@click.argument('state', type=click.Choice(['on', 'off']))
|
||||||
def config_update_bench_on_update(state):
|
def config_update_bench_on_update(state):
|
||||||
|
"Enable/Disable bench updates on running bench update"
|
||||||
state = True if state == 'on' else False
|
state = True if state == 'on' else False
|
||||||
update_config({'update_bench_on_update': state})
|
update_config({'update_bench_on_update': state})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user