2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-23 04:29:02 +00:00

add warning and fix bench update

This commit is contained in:
Pratik Vyas 2014-11-21 17:17:57 +05:30
parent bbf38c7faf
commit 8823f3b157
2 changed files with 8 additions and 9 deletions

View File

@ -201,7 +201,9 @@ def migrate_3to4(path):
@click.command('migrate-to-v5')
def _migrate_to_v5(bench='.'):
"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.argument('site')

View File

@ -3,6 +3,7 @@ from .release import get_current_version
from .app import remove_from_appstxt
import os
import shutil
import sys
repos = ('frappe', 'erpnext')
@ -12,19 +13,14 @@ def migrate_to_v5(bench='.'):
for repo in repos:
checkout_v5(repo, bench=bench)
remove_shopping_cart(bench=bench)
restart_update({
'patch': True,
'build': True,
'requirements': True,
'restart-supervisor': True
})
exec_cmd("{bench} update".format(bench=sys.argv[0]))
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(
frappe=get_frappe(bench=bench)),
cwd=os.path.join(bench, 'sites'))
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')
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)
current_version = get_current_version(path)
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='.'):
cwd = os.path.join(bench, 'apps', repo)
exec_cmd("git fetch upstream", cwd=cwd)
exec_cmd("git checkout v5.0", cwd=cwd)
exec_cmd("git clean -df", cwd=cwd)