mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 16:36:25 +00:00
Merge pull request #443 from rmehta/minor
[minor] remove bench new-site (this command is now in frappe)
This commit is contained in:
commit
de5f2fd7c4
@ -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)
|
||||
|
@ -277,4 +277,4 @@ setup.add_command(sync_domains)
|
||||
setup.add_command(setup_firewall)
|
||||
setup.add_command(set_ssh_port)
|
||||
setup.add_command(setup_roles)
|
||||
setup.add_command(setup_nginx_proxy_jail)
|
||||
setup.add_command(setup_nginx_proxy_jail)
|
||||
|
@ -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…
Reference in New Issue
Block a user