2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

fix: Allow skipping assets (#822)

fix: Allow skipping assets
This commit is contained in:
Aditya Hase 2019-07-24 14:59:41 +05:30 committed by GitHub
commit 1c8115df16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 14 deletions

View File

@ -1,12 +1,10 @@
language: python
dist: trusty
dist: xenial
python:
- "2.7"
install:
- sudo rm /etc/apt/sources.list.d/mongodb*.list
- sudo rm /etc/apt/sources.list.d/docker.list
- sudo pip install urllib3 pyOpenSSL ndg-httpsclient pyasn1
- sudo apt-get purge -y mysql-common mysql-server mysql-client
- sudo apt-get install --only-upgrade -y git
@ -16,7 +14,7 @@ install:
- cp -r $TRAVIS_BUILD_DIR/* ~/.bench
- cp -r $TRAVIS_BUILD_DIR/* /tmp/.bench
- sudo python $TRAVIS_BUILD_DIR/playbooks/install.py --user travis --run-travis --production
- sudo python $TRAVIS_BUILD_DIR/playbooks/install.py --user travis --run-travis --production --verbose
# - sudo bash $TRAVIS_BUILD_DIR/install_scripts/setup_frappe.sh --skip-install-bench --mysql-root-password travis
# - cd ~ && sudo python bench-repo/installer/install.py --only-dependencies

View File

@ -1,3 +1,4 @@
from __future__ import print_function
import os
from .utils import (exec_cmd, get_frappe, check_git_for_shallow_clone, build_assets,
restart_supervisor_processes, get_cmd_output, run_frappe_cmd, CommandFailedError,

View File

@ -13,10 +13,11 @@ import click
@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('--skip-redis-config-generation', is_flag=True, help="Skip redis config generation if already specifying the common-site-config file")
@click.option('--skip-assets',is_flag=True, default=False, help="Do not build assets")
@click.option('--verbose',is_flag=True, help="Verbose output during install")
def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups,
no_auto_update, clone_from, verbose, skip_redis_config_generation, clone_without_update,
ignore_exist = False,
ignore_exist = False, skip_assets=False,
python = 'python3'):
'''
Create a New Bench Instance.
@ -26,7 +27,7 @@ def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups,
no_auto_update=no_auto_update, frappe_path=frappe_path, frappe_branch=frappe_branch,
verbose=verbose, clone_from=clone_from, skip_redis_config_generation=skip_redis_config_generation,
clone_without_update=clone_without_update,
ignore_exist = ignore_exist,
ignore_exist = ignore_exist, skip_assets=skip_assets,
python = python)
click.echo('Bench {} initialized'.format(path))

View File

@ -37,7 +37,7 @@ 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,
verbose=False, clone_from=None, skip_redis_config_generation=False,
clone_without_update=False,
ignore_exist = False,
ignore_exist = False, skip_assets=False,
python = 'python3'): # Let's change when we're ready. - <achilles@frappe.io>
from .app import get_app, install_apps_from_path
from .config.common_site_config import make_config
@ -80,10 +80,12 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
bench.set_frappe_version(bench_path=path)
if bench.FRAPPE_VERSION > 5:
update_node_packages(bench_path=path)
if not skip_assets:
update_node_packages(bench_path=path)
set_all_patches_executed(bench_path=path)
build_assets(bench_path=path)
if not skip_assets:
build_assets(bench_path=path)
if not skip_redis_config_generation:
redis.generate_config(path)
@ -812,7 +814,7 @@ def run_playbook(playbook_name, extra_vars=None, tag=None):
if not find_executable('ansible'):
print("Ansible is needed to run this command, please install it using 'pip install ansible'")
sys.exit(1)
args = ['ansible-playbook', '-c', 'local', playbook_name]
args = ['ansible-playbook', '-c', 'local', playbook_name, '-vvvv']
if extra_vars:
args.extend(['-e', json.dumps(extra_vars)])

View File

@ -310,14 +310,11 @@ def get_extra_vars_json(extra_args):
return ('@' + json_path)
def run_playbook(playbook_name, sudo=False, extra_vars=None):
args = ['ansible-playbook', '-c', 'local', playbook_name]
args = ['ansible-playbook', '-c', 'local', playbook_name , '-vvvv']
if extra_vars:
args.extend(['-e', get_extra_vars_json(extra_vars)])
if extra_vars.get('verbosity'):
args.append('-vvvv')
if sudo:
user = extra_vars.get('user') or getpass.getuser()
args.extend(['--become', '--become-user={0}'.format(user)])