Skip to content

Commit

Permalink
Fine tune neovim role
Browse files Browse the repository at this point in the history
  • Loading branch information
notthebee committed Mar 2, 2022
1 parent e61e288 commit 8c84f70
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions roles/neovim/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- name: Check if neovim is installed via the package manager
package_facts:
manager: auto

- name: Check if neovim is installed
command:
cmd: which nvim
Expand All @@ -13,15 +17,16 @@
when: nvim.rc == 0
changed_when: False

- name: Set current neovim version to 0
- name: Set current neovim version to 0 if not installed
set_fact:
neovim_version:
stdout: 0
when: nvim.rc == 1

- name: Install github3 module
pip:
name: github3.py
name:
- github3.py

- name: Check latest neovim release
github_release:
Expand All @@ -32,6 +37,12 @@
register: neovim_release
changed_when: neovim_release.tag != neovim_version.stdout

- name: Delete the old version of nvim via the package manager
package:
name: neovim
state: absent
when: "'neovim' in ansible_facts.packages and neovim_release.tag != neovim_version.stdout"

- name: Install neovim
when: neovim_release.tag != neovim_version.stdout
block:
Expand Down Expand Up @@ -79,6 +90,12 @@
- yarn
state: present

- name: Install python modules
pip:
name:
- setuptools
- pynvim

- name: Grab the latest release source
unarchive:
src: "https://github.com/neovim/neovim/archive/{{ neovim_release['tag'] }}.tar.gz"
Expand All @@ -97,3 +114,8 @@
- name: Compile and install neovim
shell:
cmd: cd {{ neovim_source.files[0].path }} && make install

- name: Clean up
file:
path: "{{ neovim_source.files[0].path }}"
state: absent

0 comments on commit 8c84f70

Please sign in to comment.