mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 23:48:24 +00:00
resolved merge conflict
This commit is contained in:
commit
e243e6a2b8
@ -31,12 +31,11 @@ def bench_command(bench_path='.'):
|
||||
setup_logging(bench_path=bench_path)
|
||||
|
||||
|
||||
from bench.commands.make import init, get_app, new_app, remove_app, new_site
|
||||
from bench.commands.make import init, get_app, new_app, remove_app
|
||||
bench_command.add_command(init)
|
||||
bench_command.add_command(get_app)
|
||||
bench_command.add_command(new_app)
|
||||
bench_command.add_command(remove_app)
|
||||
bench_command.add_command(new_site)
|
||||
|
||||
|
||||
from bench.commands.update import update, retry_upgrade, switch_to_branch, switch_to_master, switch_to_develop
|
||||
|
@ -52,13 +52,3 @@ def remove_app(app_name):
|
||||
"completely remove app from bench"
|
||||
from bench.app import remove_app
|
||||
remove_app(app_name)
|
||||
|
||||
|
||||
@click.command('new-site')
|
||||
@click.option('--mariadb-root-password', help="MariaDB root password")
|
||||
@click.option('--admin-password', help="admin password to set for site")
|
||||
@click.argument('site')
|
||||
def new_site(site, mariadb_root_password=None, admin_password=None):
|
||||
"Create a new site in the bench"
|
||||
from bench.utils import new_site
|
||||
new_site(site, mariadb_root_password=mariadb_root_password, admin_password=admin_password)
|
||||
|
@ -1,5 +1,6 @@
|
||||
from bench.utils import exec_cmd
|
||||
import click, sys, json
|
||||
import os
|
||||
|
||||
@click.group()
|
||||
def setup():
|
||||
@ -153,6 +154,27 @@ def setup_node_requirements():
|
||||
from bench.utils import update_node_packages
|
||||
update_node_packages()
|
||||
|
||||
|
||||
@click.command('manager')
|
||||
def setup_manager():
|
||||
"Setup bench-manager.local site with the bench_manager app installed on it"
|
||||
from six.moves import input
|
||||
create_new_site = True
|
||||
if 'bench-manager.local' in os.listdir('sites'):
|
||||
ans = input('Site aleady exists. Overwrite existing new site? [Y/n]: ')
|
||||
while ans.lower() not in ['y', 'n', '']:
|
||||
ans = input('Please type "y" or "n". Site aleady exists. Overwrite existing new site? [Y/n]: ')
|
||||
if ans=='n': create_new_site = False
|
||||
if create_new_site: exec_cmd("bench new-site --force bench-manager.local")
|
||||
|
||||
if 'bench_manager' in os.listdir('apps'):
|
||||
print('App aleady exists. Skipping downloading the app')
|
||||
else:
|
||||
exec_cmd("bench get-app bench_manager")
|
||||
|
||||
exec_cmd("bench --site bench-manager.local install-app bench_manager")
|
||||
|
||||
|
||||
@click.command('config')
|
||||
def setup_config():
|
||||
"overwrite or make config.json"
|
||||
@ -254,6 +276,7 @@ setup.add_command(setup_env)
|
||||
setup.add_command(setup_procfile)
|
||||
setup.add_command(setup_socketio)
|
||||
setup.add_command(setup_requirements)
|
||||
setup.add_command(setup_manager)
|
||||
setup.add_command(setup_config)
|
||||
setup.add_command(setup_fonts)
|
||||
setup.add_command(add_domain)
|
||||
|
@ -176,35 +176,6 @@ def setup_socketio(bench_path='.'):
|
||||
exec_cmd("npm install socket.io redis express superagent cookie babel-core less chokidar \
|
||||
babel-cli babel-preset-es2015 babel-preset-es2016 babel-preset-es2017 babel-preset-babili", cwd=bench_path)
|
||||
|
||||
def new_site(site, mariadb_root_password=None, admin_password=None, bench_path='.'):
|
||||
"""
|
||||
Creates a new site in the specified bench, default is current bench
|
||||
"""
|
||||
|
||||
logger.info('creating new site {}'.format(site))
|
||||
|
||||
# consider an existing passwords.txt file
|
||||
passwords_file_path = os.path.join(os.path.expanduser('~'), 'passwords.txt')
|
||||
if os.path.isfile(passwords_file_path):
|
||||
with open(passwords_file_path, 'r') as f:
|
||||
passwords = json.load(f)
|
||||
mariadb_root_password, admin_password = passwords['mysql_root_password'], passwords['admin_password']
|
||||
|
||||
mysql_root_password_fragment = '--root_password {}'.format(mariadb_root_password) if mariadb_root_password else ''
|
||||
admin_password_fragment = '--admin_password {}'.format(admin_password) if admin_password else ''
|
||||
|
||||
exec_cmd("{frappe} {site} --install {db_name} {mysql_root_password_fragment} {admin_password_fragment}".format(
|
||||
frappe=get_frappe(bench_path=bench_path),
|
||||
site=site,
|
||||
db_name=hashlib.sha1(site).hexdigest()[:10],
|
||||
mysql_root_password_fragment=mysql_root_password_fragment,
|
||||
admin_password_fragment=admin_password_fragment
|
||||
), cwd=os.path.join(bench_path, 'sites'))
|
||||
|
||||
if len(get_sites(bench_path=bench_path)) == 1:
|
||||
exec_cmd("{frappe} --use {site}".format(frappe=get_frappe(bench_path=bench_path), site=site), cwd=os.path.join(bench_path, 'sites'))
|
||||
|
||||
|
||||
def patch_sites(bench_path='.'):
|
||||
bench.set_frappe_version(bench_path=bench_path)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user