コード例 #1
0
ファイル: utils.py プロジェクト: srajelli/bench
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,
		ignore_exist = False,
		python		 = 'python'): # Let's change when we're ready. - <*****@*****.**>
	from .app import get_app, install_apps_from_path
	from .config.common_site_config import make_config
	from .config import redis
	from .config.procfile import setup_procfile
	from bench.patches import set_all_patches_executed

	import os.path as osp

	if osp.exists(path):
		if not ignore_exist:
			raise ValueError('Bench Instance {path} already exists.'.format(path = path))
	else:
		os.makedirs(path)

	for dirname in folders_in_bench:
		try:
			os.makedirs(os.path.join(path, dirname))
		except OSError as e:
			if e.errno != os.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)
	else:
		if not frappe_path:
			frappe_path = '[email protected]:srajelli/frappe.git'

		get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, 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:
		update_node_packages(bench_path=path)

	set_all_patches_executed(bench_path=path)
	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)
コード例 #2
0
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,
		ignore_exist = False,
		python		 = 'python'): # Let's change when we're ready. - <*****@*****.**>
	from .app import get_app, install_apps_from_path
	from .config.common_site_config import make_config
	from .config import redis
	from .config.procfile import setup_procfile
	from bench.patches import set_all_patches_executed

	import os.path as osp

	if osp.exists(path):
		if not ignore_exist:
			raise ValueError('Bench Instance {path} already exists.'.format(path = path))
	else:
		os.makedirs(path)

	for dirname in folders_in_bench:
		try:
			os.makedirs(os.path.join(path, dirname))
		except OSError as e:
			if e.errno != os.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)
	else:
		if not frappe_path:
			frappe_path = 'https://github.com/frappe/frappe.git'

		get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, 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:
		update_node_packages(bench_path=path)

	set_all_patches_executed(bench_path=path)
	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)
コード例 #3
0
ファイル: utils.py プロジェクト: yvesw1/bench
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):
    from .app import get_app, install_apps_from_path
    from .config.common_site_config import make_config
    from .config import redis
    from .config.procfile import setup_procfile
    from bench.patches import set_all_patches_executed

    if os.path.exists(path):
        print 'Directory {} already exists!'.format(path)
        raise Exception("Site directory already exists")
        # sys.exit(1)

    os.makedirs(path)
    for dirname in folders_in_bench:
        os.mkdir(os.path.join(path, dirname))

    setup_logging()

    setup_env(bench_path=path)

    make_config(path)

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

        get_app(frappe_path,
                branch=frappe_branch,
                bench_path=path,
                build_asset_files=False,
                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:
        setup_socketio(bench_path=path)

    set_all_patches_executed(bench_path=path)
    build_assets(bench_path=path)
    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)
コード例 #4
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)
コード例 #5
0
ファイル: utils.py プロジェクト: britlog/bench
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,
):
    from .app import get_app, install_apps_from_path
    from .config.common_site_config import make_config
    from .config import redis
    from .config.procfile import setup_procfile
    from bench.patches import set_all_patches_executed

    if os.path.exists(path):
        print "Directory {} already exists!".format(path)
        raise Exception("Site directory already exists")
        # sys.exit(1)

    os.makedirs(path)
    for dirname in folders_in_bench:
        os.mkdir(os.path.join(path, dirname))

    setup_logging()

    setup_env(bench_path=path)

    make_config(path)

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

        get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, 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:
        setup_socketio(bench_path=path)

    set_all_patches_executed(bench_path=path)
    build_assets(bench_path=path)
    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)
コード例 #6
0
ファイル: utils.py プロジェクト: jvfiel/bench-v9
            frappe_path = 'https://github.com/jvfiel/frappe-v9.git'

        get_app(frappe_path,
                branch=frappe_branch,
                bench_path=path,
                build_asset_files=False,
                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:
        update_npm_packages(bench_path=path)

    set_all_patches_executed(bench_path=path)
    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)


def clone_apps_from(bench_path, clone_from):
    from .app import install_app
コード例 #7
0
ファイル: utils.py プロジェクト: JiShangShiDai/bench
		clone_apps_from(bench_path=path, clone_from=clone_from)
	else:
		if not frappe_path:
			frappe_path = 'https://github.com/frappe/frappe.git'

		get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, 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:
		update_npm_packages(bench_path=path)

	set_all_patches_executed(bench_path=path)
	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)

def clone_apps_from(bench_path, clone_from):
	from .app import install_app
	print('Copying apps from {0}...'.format(clone_from))