|
|
@@ -383,20 +383,47 @@ def get_version(): |
|
|
|
if hasattr(module, "__version__"): |
|
|
|
print "{0} {1}".format(m, module.__version__) |
|
|
|
|
|
|
|
@click.command('setup-help') |
|
|
|
|
|
|
|
|
|
|
|
@click.command('setup-global-help') |
|
|
|
@click.option('--mariadb_root_password') |
|
|
|
def setup_help(mariadb_root_password=None): |
|
|
|
"Make a database for help documentation" |
|
|
|
def setup_global_help(mariadb_root_password=None): |
|
|
|
'''setup help table in a separate database that will be |
|
|
|
shared by the whole bench and set `global_help_setup` as 1 in |
|
|
|
common_site_config.json''' |
|
|
|
|
|
|
|
from frappe.installer import update_site_config |
|
|
|
|
|
|
|
frappe.local.flags = frappe._dict() |
|
|
|
frappe.local.flags.in_setup_help = True |
|
|
|
frappe.local.flags.in_install = True |
|
|
|
frappe.local.lang = 'en' |
|
|
|
frappe.local.conf = frappe.get_site_config(sites_path='.') |
|
|
|
|
|
|
|
update_site_config('global_help_setup', 1, |
|
|
|
site_config_path=os.path.join('.', 'common_site_config.json')) |
|
|
|
|
|
|
|
if mariadb_root_password: |
|
|
|
frappe.local.conf.root_password = mariadb_root_password |
|
|
|
|
|
|
|
from frappe.utils.help import sync |
|
|
|
sync() |
|
|
|
|
|
|
|
@click.command('setup-help') |
|
|
|
@pass_context |
|
|
|
def setup_help(context): |
|
|
|
'''Setup help table in the current site (called after migrate)''' |
|
|
|
from frappe.utils.help import sync |
|
|
|
|
|
|
|
for site in context.sites: |
|
|
|
try: |
|
|
|
frappe.init(site) |
|
|
|
frappe.connect() |
|
|
|
sync() |
|
|
|
finally: |
|
|
|
frappe.destroy() |
|
|
|
|
|
|
|
|
|
|
|
commands = [ |
|
|
|
build, |
|
|
|
clear_cache, |
|
|
@@ -421,5 +448,6 @@ commands = [ |
|
|
|
watch, |
|
|
|
_bulk_rename, |
|
|
|
add_to_email_queue, |
|
|
|
setup_global_help, |
|
|
|
setup_help |
|
|
|
] |