mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
Add readme, first cut
This commit is contained in:
parent
8dac5a55b8
commit
418452f775
@ -5,7 +5,7 @@ from .utils import new_site as _new_site
|
|||||||
from .utils import setup_backups as _setup_backups
|
from .utils import setup_backups as _setup_backups
|
||||||
from .utils import setup_auto_update as _setup_auto_update
|
from .utils import setup_auto_update as _setup_auto_update
|
||||||
from .utils import setup_sudoers as _setup_sudoers
|
from .utils import setup_sudoers as _setup_sudoers
|
||||||
from .utils import build_assets, patch_sites, exec_cmd, update_bench, get_frappe, setup_logging
|
from .utils import build_assets, patch_sites, exec_cmd, update_bench, get_frappe, setup_logging, get_config
|
||||||
from .app import get_app as _get_app
|
from .app import get_app as _get_app
|
||||||
from .app import new_app as _new_app
|
from .app import new_app as _new_app
|
||||||
from .app import pull_all_apps
|
from .app import pull_all_apps
|
||||||
@ -61,7 +61,7 @@ def new_site(site):
|
|||||||
def update(pull=False, patch=False, build=False, bench=False):
|
def update(pull=False, patch=False, build=False, bench=False):
|
||||||
if not (pull or patch or build or bench):
|
if not (pull or patch or build or bench):
|
||||||
pull, patch, build, bench = True, True, True, True
|
pull, patch, build, bench = True, True, True, True
|
||||||
if bench:
|
if bench and get_config().get('update_bench_on_update'):
|
||||||
update_bench()
|
update_bench()
|
||||||
if pull:
|
if pull:
|
||||||
pull_all_apps()
|
pull_all_apps()
|
||||||
|
@ -3,9 +3,15 @@ import sys
|
|||||||
import subprocess
|
import subprocess
|
||||||
import getpass
|
import getpass
|
||||||
import logging
|
import logging
|
||||||
|
import json
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
default_config = {
|
||||||
|
'restart_supervisor_on_update': True,
|
||||||
|
'update_bench_on_update': True
|
||||||
|
}
|
||||||
|
|
||||||
def get_frappe(bench='.'):
|
def get_frappe(bench='.'):
|
||||||
frappe = os.path.abspath(os.path.join(bench, 'env', 'bin', 'frappe'))
|
frappe = os.path.abspath(os.path.join(bench, 'env', 'bin', 'frappe'))
|
||||||
if not os.path.exists(frappe):
|
if not os.path.exists(frappe):
|
||||||
@ -26,6 +32,7 @@ def init(path):
|
|||||||
setup_logging()
|
setup_logging()
|
||||||
|
|
||||||
setup_env(bench=path)
|
setup_env(bench=path)
|
||||||
|
put_config(default_config, bench=path)
|
||||||
get_app('frappe', 'https://github.com/frappe/frappe.git', bench=path)
|
get_app('frappe', 'https://github.com/frappe/frappe.git', bench=path)
|
||||||
setup_backups(bench=path)
|
setup_backups(bench=path)
|
||||||
setup_auto_update(bench=path)
|
setup_auto_update(bench=path)
|
||||||
@ -94,3 +101,11 @@ def setup_logging(bench='.'):
|
|||||||
hdlr.setFormatter(formatter)
|
hdlr.setFormatter(formatter)
|
||||||
logger.addHandler(hdlr)
|
logger.addHandler(hdlr)
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
def get_config(bench='.'):
|
||||||
|
with open(os.path.join(bench, 'config.json')) as f:
|
||||||
|
return json.load(f)
|
||||||
|
|
||||||
|
def put_config(config, bench='.'):
|
||||||
|
with open(os.path.join(bench, 'config.json'), 'w') as f:
|
||||||
|
return json.dump(config, f)
|
||||||
|
Loading…
Reference in New Issue
Block a user