2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-13 16:56:33 +00:00

[Fix] Add curl and wget to bench installer. Node v5 installer fixes

This commit is contained in:
shreyas 2016-07-26 12:35:04 +05:30
parent 73a6593fb9
commit 87414d218b
4 changed files with 46 additions and 21 deletions

View File

@ -9,18 +9,20 @@ def execute(bench_path):
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')
click.echo('''
No node executable was found on your machine.
Please install node 5.x before running "bench update".
Installation instructions for CentOS and Ubuntu can be found on the following link,
"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/"
''')
sys.exit(1)
node_ver = Version(result.rstrip('\n').lstrip('v'))
if node_ver < expected_node_ver:
click.echo('''Please update node version to 5.x before running "bench update".
'Installation instructions for CentOS and Ubuntu can be found on the following link,
'"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/"
''')
click.echo('''
Please update node version to 5.x before running "bench update".
Installation instructions for CentOS and Ubuntu can be found on the following link,
"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/"
''')
sys.exit(1)

View File

@ -47,15 +47,14 @@
yum:
name: https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm
state: present
update_cache: yes
become: yes
become_user: root
- name: Install nodejs v5
yum: name={{ item }} state=present
with_items:
- nodejs
- npm
yum:
name: nodejs
state: present
update_cache: yes
become: yes
become_user: root

View File

@ -58,17 +58,24 @@
become_user: root
- name: Add nodejs v5 repo
shell: 'curl -sL https://deb.nodesource.com/setup_5.x'
args:
executable: /bin/bash
get_url:
url: 'https://deb.nodesource.com/setup_5.x'
dest: '/tmp/setup_5.x'
mode: 0644
become: yes
become_user: root
- name: Install setup_5.x
command: /bin/bash /tmp/setup_5.x
become: yes
become_user: root
- name: Update and Install Node v5
apt: name={{ item }} state=present update_cache=yes force=yes
with_items:
- nodejs
- npm
apt:
name: nodejs
state: present
update_cache: yes
force: yes
become: yes
become_user: root

View File

@ -6,6 +6,9 @@ tmp_bench_repo = '/tmp/.bench'
def install_bench(args):
# pre-requisites for bench repo cloning
install_package('curl')
install_package('wget')
success = run_os_command({
'apt-get': [
'sudo apt-get update',
@ -122,6 +125,20 @@ def install_python27():
# replace current python with python2.7
os.execvp('python2.7', ([] if is_sudo_user() else ['sudo']) + ['python2.7', __file__] + sys.argv[1:])
def install_package(package):
package_exec = find_executable(package)
if not package_exec:
success = run_os_command({
'apt-get': ['sudo apt-get install -y {0}'.format(package)],
'yum': ['sudo yum install -y {0}'.format(package)]
})
else:
return
if not success:
could_not_install(package)
def clone_bench_repo(args):
'''Clones the bench repository in the user folder'''
if os.path.exists(tmp_bench_repo):