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

Rename method names

Removed print statements
This commit is contained in:
Shridhar 2018-01-20 16:21:16 +05:30
parent d80ded2c88
commit 3b5da2960d
4 changed files with 13 additions and 15 deletions

View File

@ -70,21 +70,21 @@ def get_excluded_apps(bench_path='.'):
except IOError: except IOError:
return [] return []
def add_to_excluded_appstxt(app, bench_path='.'): def add_to_excluded_apps_txt(app, bench_path='.'):
apps = get_excluded_apps(bench_path=bench_path) apps = get_excluded_apps(bench_path=bench_path)
if app not in apps: if app not in apps:
apps.append(app) apps.append(app)
return write_excluded_appstxt(apps, bench_path=bench_path) return write_excluded_apps_txt(apps, bench_path=bench_path)
def write_excluded_appstxt(apps, bench_path='.'): def write_excluded_apps_txt(apps, bench_path='.'):
with open(os.path.join(bench_path, 'sites', 'excluded_apps.txt'), 'w') as f: with open(os.path.join(bench_path, 'sites', 'excluded_apps.txt'), 'w') as f:
return f.write('\n'.join(apps)) return f.write('\n'.join(apps))
def remove_from_exclided_appsstxt(app, bench_path='.'): def remove_from_excluded_apps_txt(app, bench_path='.'):
apps = get_apps(bench_path=bench_path) apps = get_excluded_apps(bench_path=bench_path)
if app in apps: if app in apps:
apps.remove(app) apps.remove(app)
return write_excluded_appstxt(apps, bench_path=bench_path) return write_excluded_apps_txt(apps, bench_path=bench_path)
def get_app(git_url, branch=None, bench_path='.', build_asset_files=True, verbose=False): def get_app(git_url, branch=None, bench_path='.', build_asset_files=True, verbose=False):
# from bench.utils import check_url # from bench.utils import check_url
@ -188,7 +188,6 @@ def remove_app(app, bench_path='.'):
def pull_all_apps(bench_path='.', reset=False, exclude=True): def pull_all_apps(bench_path='.', reset=False, exclude=True):
'''Check all apps if there no local changes, pull''' '''Check all apps if there no local changes, pull'''
rebase = '--rebase' if get_config(bench_path).get('rebase_on_pull') else '' rebase = '--rebase' if get_config(bench_path).get('rebase_on_pull') else ''
print("Pull all apps {}".format(exclude))
# chech for local changes # chech for local changes
if not reset: if not reset:
for app in get_apps(bench_path=bench_path): for app in get_apps(bench_path=bench_path):

View File

@ -8,8 +8,8 @@ bench exclude-app <app-name>
import click import click
from bench.app import add_to_excluded_appstxt from bench.app import add_to_excluded_apps_txt
from bench.app import remove_from_exclided_appsstxt from bench.app import remove_from_excluded_apps_txt
@click.command('exclude-app') @click.command('exclude-app')
@click.argument('app_name') @click.argument('app_name')
@ -19,7 +19,7 @@ def exclude_app_for_update(app_name):
:param app_name(str): App name :param app_name(str): App name
""" """
add_to_excluded_appstxt(app_name) add_to_excluded_apps_txt(app_name)
return return
@ -31,5 +31,5 @@ def include_app_for_update(app_name):
:param app_name(str): App name :param app_name(str): App name
""" """
remove_from_exclided_appsstxt(app_name) remove_from_excluded_apps_txt(app_name)
return return

View File

@ -21,7 +21,7 @@ from bench import patches
@click.option('--no-backup', is_flag=True) @click.option('--no-backup', is_flag=True)
@click.option('--force', is_flag=True) @click.option('--force', is_flag=True)
@click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull") @click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull")
def update(exclude=False, pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, force=False, reset=False): def update(exclude_apps=False, pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, force=False, reset=False):
"""Update bench""" """Update bench"""
if not (pull or patch or build or bench or requirements): if not (pull or patch or build or bench or requirements):
pull, patch, build, bench, requirements = True, True, True, True, True pull, patch, build, bench, requirements = True, True, True, True, True
@ -34,7 +34,7 @@ def update(exclude=False, pull=False, patch=False, build=False, bench=False, aut
if bench and conf.get('update_bench_on_update'): if bench and conf.get('update_bench_on_update'):
update_bench() update_bench()
restart_update({ restart_update({
'exclude': exclude, 'exclude-apps': exclude_apps,
'pull': pull, 'pull': pull,
'patch': patch, 'patch': patch,
'build': build, 'build': build,
@ -57,7 +57,7 @@ def update(exclude=False, pull=False, patch=False, build=False, bench=False, aut
print("This would take significant time to migrate and might break custom apps.") print("This would take significant time to migrate and might break custom apps.")
click.confirm('Do you want to continue?', abort=True) click.confirm('Do you want to continue?', abort=True)
_update(exclude, pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, force=force, reset=reset) _update(exclude_apps, pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, force=force, reset=reset)
def _update(exclude=False, pull=False, patch=False, build=False, update_bench=False, auto=False, restart_supervisor=False, def _update(exclude=False, pull=False, patch=False, build=False, update_bench=False, auto=False, restart_supervisor=False,
requirements=False, no_backup=False, bench_path='.', force=False, reset=False): requirements=False, no_backup=False, bench_path='.', force=False, reset=False):

View File

@ -278,7 +278,6 @@ def update_bench():
# bench-repo folder # bench-repo folder
cwd = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) cwd = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
print(cwd)
exec_cmd("git pull", cwd=cwd) exec_cmd("git pull", cwd=cwd)
def setup_sudoers(user): def setup_sudoers(user):