2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 09:02:10 +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: if node_exec:
result = subprocess.check_output([node_exec, '-v']) result = subprocess.check_output([node_exec, '-v'])
else: else:
click.echo('\nNo node executable was found on your machine.\nPlease install node 5.x before\n' click.echo('''
'running "bench update".\nInstallation instructions for CentOS and Ubuntu can be found on \n' No node executable was found on your machine.
'the following link,\n' Please install node 5.x before running "bench update".
'"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/"\n\n') 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) sys.exit(1)
node_ver = Version(result.rstrip('\n').lstrip('v')) node_ver = Version(result.rstrip('\n').lstrip('v'))
if node_ver < expected_node_ver: if node_ver < expected_node_ver:
click.echo('''Please update node version to 5.x before running "bench update". click.echo('''
'Installation instructions for CentOS and Ubuntu can be found on the following link, Please update node version to 5.x before running "bench update".
'"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/" 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) sys.exit(1)

View File

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

View File

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

View File

@ -6,6 +6,9 @@ tmp_bench_repo = '/tmp/.bench'
def install_bench(args): def install_bench(args):
# pre-requisites for bench repo cloning # pre-requisites for bench repo cloning
install_package('curl')
install_package('wget')
success = run_os_command({ success = run_os_command({
'apt-get': [ 'apt-get': [
'sudo apt-get update', 'sudo apt-get update',
@ -122,6 +125,20 @@ def install_python27():
# replace current python with python2.7 # replace current python with python2.7
os.execvp('python2.7', ([] if is_sudo_user() else ['sudo']) + ['python2.7', __file__] + sys.argv[1:]) 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): def clone_bench_repo(args):
'''Clones the bench repository in the user folder''' '''Clones the bench repository in the user folder'''
if os.path.exists(tmp_bench_repo): if os.path.exists(tmp_bench_repo):