mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 07:28:25 +00:00
bench init --verbose
This commit is contained in:
parent
4ec9bed9bb
commit
c45cb2b003
@ -40,7 +40,7 @@ def write_appstxt(apps, bench='.'):
|
|||||||
with open(os.path.join(bench, 'sites', 'apps.txt'), 'w') as f:
|
with open(os.path.join(bench, 'sites', 'apps.txt'), 'w') as f:
|
||||||
return f.write('\n'.join(apps))
|
return f.write('\n'.join(apps))
|
||||||
|
|
||||||
def get_app(app, git_url, branch=None, bench='.', build_asset_files=True):
|
def get_app(app, git_url, branch=None, bench='.', build_asset_files=True, verbose=False):
|
||||||
logger.info('getting app {}'.format(app))
|
logger.info('getting app {}'.format(app))
|
||||||
shallow_clone = '--depth 1' if check_git_for_shallow_clone() and get_config().get('shallow_clone') else ''
|
shallow_clone = '--depth 1' if check_git_for_shallow_clone() and get_config().get('shallow_clone') else ''
|
||||||
branch = '--branch {branch}'.format(branch=branch) if branch else ''
|
branch = '--branch {branch}'.format(branch=branch) if branch else ''
|
||||||
@ -51,7 +51,7 @@ def get_app(app, git_url, branch=None, bench='.', build_asset_files=True):
|
|||||||
branch=branch),
|
branch=branch),
|
||||||
cwd=os.path.join(bench, 'apps'))
|
cwd=os.path.join(bench, 'apps'))
|
||||||
print 'installing', app
|
print 'installing', app
|
||||||
install_app(app, bench=bench)
|
install_app(app, bench=bench, verbose=verbose)
|
||||||
if build_asset_files:
|
if build_asset_files:
|
||||||
build_assets(bench=bench)
|
build_assets(bench=bench)
|
||||||
conf = get_config()
|
conf = get_config()
|
||||||
@ -68,12 +68,13 @@ def new_app(app, bench='.'):
|
|||||||
run_frappe_cmd('make-app', apps, app, bench=bench)
|
run_frappe_cmd('make-app', apps, app, bench=bench)
|
||||||
install_app(app, bench=bench)
|
install_app(app, bench=bench)
|
||||||
|
|
||||||
def install_app(app, bench='.'):
|
def install_app(app, bench='.', verbose=False):
|
||||||
logger.info('installing {}'.format(app))
|
logger.info('installing {}'.format(app))
|
||||||
conf = get_config()
|
conf = get_config()
|
||||||
find_links = '--find-links={}'.format(conf.get('wheel_cache_dir')) if conf.get('wheel_cache_dir') else ''
|
find_links = '--find-links={}'.format(conf.get('wheel_cache_dir')) if conf.get('wheel_cache_dir') else ''
|
||||||
exec_cmd("{pip} install -q {find_links} -e {app}".format(
|
exec_cmd("{pip} install {quiet} {find_links} -e {app}".format(
|
||||||
pip=os.path.join(bench, 'env', 'bin', 'pip'),
|
pip=os.path.join(bench, 'env', 'bin', 'pip'),
|
||||||
|
quiet="-q" if not verbose else "",
|
||||||
app=os.path.join(bench, 'apps', app),
|
app=os.path.join(bench, 'apps', app),
|
||||||
find_links=find_links))
|
find_links=find_links))
|
||||||
add_to_appstxt(app, bench=bench)
|
add_to_appstxt(app, bench=bench)
|
||||||
|
@ -158,11 +158,12 @@ def bench(bench='.'):
|
|||||||
@click.option('--no-procfile', is_flag=True, help="Pull changes in all the apps in bench")
|
@click.option('--no-procfile', is_flag=True, help="Pull changes in all the apps in bench")
|
||||||
@click.option('--no-backups',is_flag=True, help="Run migrations for all sites in the bench")
|
@click.option('--no-backups',is_flag=True, help="Run migrations for all sites in the bench")
|
||||||
@click.option('--no-auto-update',is_flag=True, help="Build JS and CSS artifacts for the bench")
|
@click.option('--no-auto-update',is_flag=True, help="Build JS and CSS artifacts for the bench")
|
||||||
|
@click.option('--verbose',is_flag=True, help="Verbose output during install")
|
||||||
def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups,
|
def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups,
|
||||||
no_auto_update):
|
no_auto_update, verbose):
|
||||||
"Create a new bench"
|
"Create a new bench"
|
||||||
_init(path, apps_path=apps_path, no_procfile=no_procfile, no_backups=no_backups,
|
_init(path, apps_path=apps_path, no_procfile=no_procfile, no_backups=no_backups,
|
||||||
no_auto_update=no_auto_update, frappe_path=frappe_path, frappe_branch=frappe_branch)
|
no_auto_update=no_auto_update, frappe_path=frappe_path, frappe_branch=frappe_branch, verbose=verbose)
|
||||||
click.echo('Bench {} initialized'.format(path))
|
click.echo('Bench {} initialized'.format(path))
|
||||||
|
|
||||||
@click.command('get-app')
|
@click.command('get-app')
|
||||||
|
@ -44,7 +44,8 @@ def get_env_cmd(cmd, bench='.'):
|
|||||||
return os.path.abspath(os.path.join(bench, 'env', 'bin', cmd))
|
return os.path.abspath(os.path.join(bench, 'env', 'bin', cmd))
|
||||||
|
|
||||||
def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
||||||
no_auto_update=False, frappe_path=None, frappe_branch=None, wheel_cache_dir=None):
|
no_auto_update=False, frappe_path=None, frappe_branch=None, wheel_cache_dir=None,
|
||||||
|
verbose=False):
|
||||||
from .app import get_app, install_apps_from_path
|
from .app import get_app, install_apps_from_path
|
||||||
from .config import generate_redis_cache_config, generate_redis_async_broker_config
|
from .config import generate_redis_cache_config, generate_redis_async_broker_config
|
||||||
global FRAPPE_VERSION
|
global FRAPPE_VERSION
|
||||||
@ -68,7 +69,7 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
|||||||
|
|
||||||
if not frappe_path:
|
if not frappe_path:
|
||||||
frappe_path = 'https://github.com/frappe/frappe.git'
|
frappe_path = 'https://github.com/frappe/frappe.git'
|
||||||
get_app('frappe', frappe_path, branch=frappe_branch, bench=path, build_asset_files=False)
|
get_app('frappe', frappe_path, branch=frappe_branch, bench=path, build_asset_files=False, verbose=verbose)
|
||||||
if not no_procfile:
|
if not no_procfile:
|
||||||
setup_procfile(bench=path)
|
setup_procfile(bench=path)
|
||||||
if not no_backups:
|
if not no_backups:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user