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

Merge pull request #271 from shreyasp/bench/update-node-install

[Fix] Updated the patch to find node executable and installation instructions
This commit is contained in:
Rushabh Mehta 2016-07-26 07:54:42 +05:30 committed by GitHub
commit 2e2ff56d0a

View File

@ -1,12 +1,24 @@
import click, subprocess, sys
from semantic_version import Version
from distutils.spawn import find_executable
def execute(bench_path):
expected_node_ver = Version('5.0.0')
node_exec = find_executable('node')
if node_exec:
result = subprocess.check_output([node_exec, '-v'])
else:
click.echo('\nNo node executable was found on your machine.\nPlease install node 5.x before\n'
'running "bench update".\nInstallation instructions for CentOS and Ubuntu can be found on \n'
'the following link,\n'
'"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/"\n\n')
sys.exit(1)
result = subprocess.check_output(['node', '-v'])
node_ver = Version(result.rstrip('\n').lstrip('v'))
if node_ver < expected_node_ver:
click.echo('\nPlease update node version to 5.x before running the "bench update"\n\n')
click.echo('\nPlease update node version to 5.x before running "bench update".\n'
'Installation instructions for CentOS and Ubuntu can be found on the following link,\n
'"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/"\n\n')
sys.exit(1)