예제 #1
0
파일: utils.py 프로젝트: bala07123/erp
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, skip_assets=False, python='python3'):
	from bench.app import get_app, install_apps_from_path
	from bench.config import redis
	from bench.config.common_site_config import make_config
	from bench.config.procfile import setup_procfile
	from bench.patches import set_all_patches_executed

	if os.path.exists(path) and not ignore_exist:
		log('Path {path} already exists!'.format(path=path))
		sys.exit(0)
	elif not os.path.exists(path):
		# only create dir if it does not exist
		os.makedirs(path)

	for dirname in folders_in_bench:
		try:
			os.makedirs(os.path.join(path, dirname))
		except OSError as e:
			if e.errno == errno.EEXIST:
				pass

	setup_logging()

	setup_env(bench_path=path, python=python)

	make_config(path)

	if clone_from:
		clone_apps_from(bench_path=path, clone_from=clone_from, update_app=not clone_without_update)
	else:
		if not frappe_path:
			frappe_path = 'https://github.com/frappe/frappe.git'

		get_app(frappe_path, branch=frappe_branch, bench_path=path, skip_assets=True, verbose=verbose)

		if apps_path:
			install_apps_from_path(apps_path, bench_path=path)


	bench.set_frappe_version(bench_path=path)
	if bench.FRAPPE_VERSION > 5:
		if not skip_assets:
			update_node_packages(bench_path=path)

	set_all_patches_executed(bench_path=path)
	if not skip_assets:
		build_assets(bench_path=path)

	if not skip_redis_config_generation:
		redis.generate_config(path)

	if not no_procfile:
		setup_procfile(path)
	if not no_backups:
		setup_backups(bench_path=path)
	if not no_auto_update:
		setup_auto_update(bench_path=path)
	copy_patches_txt(path)
예제 #2
0
def execute(bench_path):
	click.confirm('\nThis update will remove Celery config and prepare the bench to use Python RQ.\n'
		'And it will overwrite Procfile and supervisor.conf.\n'
		'If you don\'t know what this means, type Y ;)\n\n'
		'Do you want to continue?',
		abort=True)

	setup_procfile(bench_path, force=True)

	# if production setup
	if os.path.exists(os.path.join(bench_path, 'config', 'supervisor.conf')):
		generate_supervisor_config(bench_path, force=True)
예제 #3
0
def execute(bench_path):
    click.confirm(
        '\nThis update will remove Celery config and prepare the bench to use Python RQ.\n'
        'And it will overwrite Procfile and supervisor.conf.\n'
        'If you don\'t know what this means, type Y ;)\n\n'
        'Do you want to continue?',
        abort=True)

    setup_procfile(bench_path, force=True)

    # if production setup
    if os.path.exists(os.path.join(bench_path, 'config', 'supervisor.conf')):
        generate_supervisor_config(bench_path, force=True)
예제 #4
0
def execute(bench_path):
	frappe_branch = get_current_branch('frappe', bench_path)
	frappe_version = get_current_frappe_version(bench_path)

	if not (frappe_branch=='develop' or frappe_version >= 7):
		# not version 7+
		# prevent running this patch
		return False

	click.confirm('\nThis update will remove Celery config and prepare the bench to use Python RQ.\n'
		'And it will overwrite Procfile and supervisor.conf.\n'
		'If you don\'t know what this means, type Y ;)\n\n'
		'Do you want to continue?',
		abort=True)

	setup_procfile(bench_path, yes=True)

	# if production setup
	if os.path.exists(os.path.join(bench_path, 'config', 'supervisor.conf')):
		generate_supervisor_config(bench_path, yes=True)
예제 #5
0
def setup_procfile():
    "Setup Procfile for bench start"
    from bench.config.procfile import setup_procfile
    setup_procfile('.')
예제 #6
0
파일: setup.py 프로젝트: kossanah/bench
def setup_procfile():
	"Setup Procfile for bench start"
	from bench.config.procfile import setup_procfile
	setup_procfile('.')
예제 #7
0
def setup_procfile():
    from bench.config.procfile import setup_procfile
    setup_procfile(".")