2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 00:37:51 +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:
Ameya Shenoy 2018-04-11 16:30:14 +05:30 committed by GitHub
commit de5f2fd7c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 42 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)