2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-24 13:09:01 +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 language: python
dist: trusty dist: xenial
python: python:
- "2.7" - "2.7"
install: 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 pip install urllib3 pyOpenSSL ndg-httpsclient pyasn1
- sudo apt-get purge -y mysql-common mysql-server mysql-client - sudo apt-get purge -y mysql-common mysql-server mysql-client
- sudo apt-get install --only-upgrade -y git - sudo apt-get install --only-upgrade -y git
@ -16,7 +14,7 @@ install:
- cp -r $TRAVIS_BUILD_DIR/* ~/.bench - cp -r $TRAVIS_BUILD_DIR/* ~/.bench
- cp -r $TRAVIS_BUILD_DIR/* /tmp/.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 # - 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 # - cd ~ && sudo python bench-repo/installer/install.py --only-dependencies

View File

@ -1,3 +1,4 @@
from __future__ import print_function
import os import os
from .utils import (exec_cmd, get_frappe, check_git_for_shallow_clone, build_assets, from .utils import (exec_cmd, get_frappe, check_git_for_shallow_clone, build_assets,
restart_supervisor_processes, get_cmd_output, run_frappe_cmd, CommandFailedError, 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-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('--skip-redis-config-generation', is_flag=True, help="Skip redis config generation if already specifying the common-site-config file") @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") @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, clone_from, verbose, skip_redis_config_generation, clone_without_update, no_auto_update, clone_from, verbose, skip_redis_config_generation, clone_without_update,
ignore_exist = False, ignore_exist = False, skip_assets=False,
python = 'python3'): python = 'python3'):
''' '''
Create a New Bench Instance. 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, 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, verbose=verbose, clone_from=clone_from, skip_redis_config_generation=skip_redis_config_generation,
clone_without_update=clone_without_update, clone_without_update=clone_without_update,
ignore_exist = ignore_exist, ignore_exist = ignore_exist, skip_assets=skip_assets,
python = python) python = python)
click.echo('Bench {} initialized'.format(path)) 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, no_auto_update=False, frappe_path=None, frappe_branch=None, wheel_cache_dir=None,
verbose=False, clone_from=None, skip_redis_config_generation=False, verbose=False, clone_from=None, skip_redis_config_generation=False,
clone_without_update=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> python = 'python3'): # Let's change when we're ready. - <achilles@frappe.io>
from .app import get_app, install_apps_from_path from .app import get_app, install_apps_from_path
from .config.common_site_config import make_config from .config.common_site_config import make_config
@ -80,9 +80,11 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
bench.set_frappe_version(bench_path=path) bench.set_frappe_version(bench_path=path)
if bench.FRAPPE_VERSION > 5: if bench.FRAPPE_VERSION > 5:
if not skip_assets:
update_node_packages(bench_path=path) update_node_packages(bench_path=path)
set_all_patches_executed(bench_path=path) set_all_patches_executed(bench_path=path)
if not skip_assets:
build_assets(bench_path=path) build_assets(bench_path=path)
if not skip_redis_config_generation: if not skip_redis_config_generation:
@ -812,7 +814,7 @@ def run_playbook(playbook_name, extra_vars=None, tag=None):
if not find_executable('ansible'): if not find_executable('ansible'):
print("Ansible is needed to run this command, please install it using 'pip install ansible'") print("Ansible is needed to run this command, please install it using 'pip install ansible'")
sys.exit(1) sys.exit(1)
args = ['ansible-playbook', '-c', 'local', playbook_name] args = ['ansible-playbook', '-c', 'local', playbook_name, '-vvvv']
if extra_vars: if extra_vars:
args.extend(['-e', json.dumps(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) return ('@' + json_path)
def run_playbook(playbook_name, sudo=False, extra_vars=None): 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: if extra_vars:
args.extend(['-e', get_extra_vars_json(extra_vars)]) args.extend(['-e', get_extra_vars_json(extra_vars)])
if extra_vars.get('verbosity'):
args.append('-vvvv')
if sudo: if sudo:
user = extra_vars.get('user') or getpass.getuser() user = extra_vars.get('user') or getpass.getuser()
args.extend(['--become', '--become-user={0}'.format(user)]) args.extend(['--become', '--become-user={0}'.format(user)])