mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 00:37:51 +00:00
add warning and fix bench update
This commit is contained in:
parent
bbf38c7faf
commit
8823f3b157
@ -201,7 +201,9 @@ def migrate_3to4(path):
|
|||||||
@click.command('migrate-to-v5')
|
@click.command('migrate-to-v5')
|
||||||
def _migrate_to_v5(bench='.'):
|
def _migrate_to_v5(bench='.'):
|
||||||
"Migrate to Version 5"
|
"Migrate to Version 5"
|
||||||
migrate_to_v5(bench=bench)
|
click.echo("This will migrate all sites in the bench to version 5.")
|
||||||
|
if click.confirm("This is irreversible. Do you want to continue?", abort=True):
|
||||||
|
migrate_to_v5(bench=bench)
|
||||||
|
|
||||||
@click.command('set-nginx-port')
|
@click.command('set-nginx-port')
|
||||||
@click.argument('site')
|
@click.argument('site')
|
||||||
|
@ -3,6 +3,7 @@ from .release import get_current_version
|
|||||||
from .app import remove_from_appstxt
|
from .app import remove_from_appstxt
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
repos = ('frappe', 'erpnext')
|
repos = ('frappe', 'erpnext')
|
||||||
|
|
||||||
@ -12,19 +13,14 @@ def migrate_to_v5(bench='.'):
|
|||||||
for repo in repos:
|
for repo in repos:
|
||||||
checkout_v5(repo, bench=bench)
|
checkout_v5(repo, bench=bench)
|
||||||
remove_shopping_cart(bench=bench)
|
remove_shopping_cart(bench=bench)
|
||||||
restart_update({
|
exec_cmd("{bench} update".format(bench=sys.argv[0]))
|
||||||
'patch': True,
|
|
||||||
'build': True,
|
|
||||||
'requirements': True,
|
|
||||||
'restart-supervisor': True
|
|
||||||
})
|
|
||||||
|
|
||||||
def remove_shopping_cart(bench='.'):
|
def remove_shopping_cart(bench='.'):
|
||||||
exec_cmd("{pip} --no-input uninstall -y shopping_cart".format(pip=os.path.join(bench, 'env', 'bin', 'pip')))
|
|
||||||
exec_cmd("{frappe} all --remove_from_installed_apps shopping_cart".format(
|
exec_cmd("{frappe} all --remove_from_installed_apps shopping_cart".format(
|
||||||
frappe=get_frappe(bench=bench)),
|
frappe=get_frappe(bench=bench)),
|
||||||
cwd=os.path.join(bench, 'sites'))
|
cwd=os.path.join(bench, 'sites'))
|
||||||
remove_from_appstxt('shopping_cart', bench=bench)
|
remove_from_appstxt('shopping_cart', bench=bench)
|
||||||
|
exec_cmd("{pip} --no-input uninstall -y shopping_cart".format(pip=os.path.join(bench, 'env', 'bin', 'pip')))
|
||||||
|
|
||||||
archived_apps_dir = os.path.join(bench, 'archived_apps')
|
archived_apps_dir = os.path.join(bench, 'archived_apps')
|
||||||
shopping_cart_dir = os.path.join(bench, 'apps', 'shopping_cart')
|
shopping_cart_dir = os.path.join(bench, 'apps', 'shopping_cart')
|
||||||
@ -37,10 +33,11 @@ def validate_v4(bench='.'):
|
|||||||
path = os.path.join(bench, 'apps', repo)
|
path = os.path.join(bench, 'apps', repo)
|
||||||
current_version = get_current_version(path)
|
current_version = get_current_version(path)
|
||||||
if not current_version.startswith('4'):
|
if not current_version.startswith('4'):
|
||||||
raise Exception("{} is not v4.x.x")
|
raise Exception("{} is not on v4.x.x".format(repo))
|
||||||
|
|
||||||
def checkout_v5(repo, bench='.'):
|
def checkout_v5(repo, bench='.'):
|
||||||
cwd = os.path.join(bench, 'apps', repo)
|
cwd = os.path.join(bench, 'apps', repo)
|
||||||
exec_cmd("git fetch upstream", cwd=cwd)
|
exec_cmd("git fetch upstream", cwd=cwd)
|
||||||
exec_cmd("git checkout v5.0", cwd=cwd)
|
exec_cmd("git checkout v5.0", cwd=cwd)
|
||||||
|
exec_cmd("git clean -df", cwd=cwd)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user