2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-24 13:09:01 +00:00
This commit is contained in:
Rushabh Mehta 2017-07-05 09:19:01 +05:30
parent a6a1ee9a82
commit 794287d971
6 changed files with 10 additions and 34 deletions

View File

@ -55,7 +55,7 @@ def get_app(git_url, branch=None, bench_path='.', build_asset_files=True, verbos
#Gets repo name from URL
repo_name = git_url.rsplit('/', 1)[1].rsplit('.', 1)[0]
logger.info('getting app {}'.format(repo_name))
shallow_clone = '--depth 1' if check_git_for_shallow_clone() else ''
shallow_clone = '--depth 1 --no-single-branch' if check_git_for_shallow_clone() else ''
branch = '--branch {branch}'.format(branch=branch) if branch else ''
exec_cmd("git clone {git_url} {branch} {shallow_clone} --origin upstream".format(
@ -135,7 +135,7 @@ def remove_app(app, bench_path='.'):
def pull_all_apps(bench_path='.', reset=False):
'''Check all apps if there no local changes, pull'''
rebase = '--rebase' if get_config(bench_path).get('rebase_on_pull') else ''
# chech for local changes
if not reset:
for app in get_apps(bench_path=bench_path):

View File

@ -21,12 +21,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

@ -46,13 +46,3 @@ def remove_app(app_name):
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

@ -49,11 +49,12 @@ def setup_fonts():
@click.command('production')
@click.option('--yes', is_flag=True, default=False, help='Dont prompt for confirmation')
@click.argument('user')
def setup_production(user):
def setup_production(user, yes=False):
"setup bench for production"
from bench.config.production_setup import setup_production
setup_production(user=user)
setup_production(user=user, yes=yes)
@click.command('auto-update')

View File

@ -3,9 +3,9 @@ from bench.config.supervisor import generate_supervisor_config
from bench.config.nginx import make_nginx_conf
import os, subprocess
def setup_production(user, bench_path='.'):
generate_supervisor_config(bench_path=bench_path, user=user)
make_nginx_conf(bench_path=bench_path)
def setup_production(user, bench_path='.', yes=False):
generate_supervisor_config(bench_path=bench_path, user=user, yes=yes)
make_nginx_conf(bench_path=bench_path, yes=yes)
fix_prod_setup_perms(bench_path, frappe_user=user)
remove_default_nginx_configs()

View File

@ -139,20 +139,6 @@ def setup_env(bench_path='.'):
def setup_socketio(bench_path='.'):
exec_cmd("npm install socket.io redis express superagent cookie", cwd=bench_path)
def new_site(site, mariadb_root_password=None, admin_password=None, bench_path='.'):
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} {site} --install {db_name} {mariadb_root_password_fragment} {admin_password_fragment}".format(
frappe=get_frappe(bench_path=bench_path),
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_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)
@ -601,7 +587,7 @@ def update_translations(app, lang):
f.flush()
print('downloaded for', app, lang)
def download_chart_of_accounts():
charts_dir = os.path.join('apps', "erpnext", "erpnext", 'accounts', 'chart_of_accounts', "submitted")
csv_file = os.path.join(translations_dir, lang + '.csv')