2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

[minor] fixes for new-app and new-site

This commit is contained in:
Rushabh Mehta 2015-02-10 12:37:51 +05:30
parent 36b6ffed9a
commit f09efcb0ae
2 changed files with 7 additions and 4 deletions

View File

@ -50,7 +50,8 @@ def get_app(app, git_url, branch=None, bench='.', build_asset_files=True):
def new_app(app, bench='.'):
logger.info('creating new app {}'.format(app))
exec_cmd("{frappe} --make_app {apps}".format(frappe=get_frappe(bench=bench), apps=os.path.join(bench, 'apps')))
exec_cmd("{frappe} --make_app {apps} {app}".format(frappe=get_frappe(bench=bench),
apps=os.path.join(bench, 'apps'), app=app))
install_app(app, bench=bench)
def install_app(app, bench='.'):

View File

@ -75,12 +75,14 @@ worker: sh -c 'cd sites && exec ../env/bin/python -m frappe.celery_app worker'
workerbeat: sh -c 'cd sites && exec ../env/bin/python -m frappe.celery_app beat -s scheduler.schedule'""")
def new_site(site, mariadb_root_password=None, admin_password=None, bench='.'):
import hashlib
logger.info('creating new site {}'.format(site))
mariadb_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} --install {site} {site} {mariadb_root_password_fragment} {admin_password_fragment}".format(
exec_cmd("{frappe} {site} --install {db_name} {mariadb_root_password_fragment} {admin_password_fragment}".format(
frappe=get_frappe(bench=bench),
site=site,
db_name = hashlib.sha1(site).hexdigest()[:10],
mariadb_root_password_fragment=mariadb_root_password_fragment,
admin_password_fragment=admin_password_fragment
), cwd=os.path.join(bench, 'sites'))