Skip to content

Commit

Permalink
Pinned Antigen version
Browse files Browse the repository at this point in the history
Pinned the Antigen version to the 2.0.2 release.

Later versions suffer from the following bug: zsh-users/antigen#583
  • Loading branch information
freemanjp committed Aug 15, 2018
1 parent 0879a53 commit d0d4403
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 10 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ Role Variables
The following variables will change the behavior of this role:

```yaml
# Antigen version number
antigen_version: '2.0.2'

# SHA256 sum for the redistributable package
antigen_redis_sha256sum: 'f47ec933b32c578abe8cb39b24e0ddd114ef5cc01b3c05bcb634859ead31493f'

# Should Oh-My-Zsh be installed with Antigen (doesn't call `antigen use`)
antigen_install_oh_my_zsh: yes

# Mirror location for Antigen download
antigen_redis_mirror: 'https://github.com/zsh-users/antigen/releases/download/v{{ antigen_version }}'

# Directory to store files downloaded for Antigen installation on the remote box
antigen_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"

# Antigen is installed per user so you need to specify the users to install it for
users:
- username: # The username of the user to install Antigen for
Expand Down
12 changes: 12 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
---
# Antigen version number
antigen_version: '2.0.2'

# SHA256 sum for the redistributable package
antigen_redis_sha256sum: 'f47ec933b32c578abe8cb39b24e0ddd114ef5cc01b3c05bcb634859ead31493f'

# Should Oh-My-Zsh be installed with Antigen (doesn't call `antigen use`)
antigen_install_oh_my_zsh: yes

# Mirror location for Antigen download
antigen_redis_mirror: 'https://github.com/zsh-users/antigen/releases/download/v{{ antigen_version }}'

# Directory to store files downloaded for Antigen installation on the remote box
antigen_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"
11 changes: 11 additions & 0 deletions molecule/default/tests/test_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ def test_antigen_install(File, username):
assert antigen.group in [username, 'users']


@pytest.mark.parametrize('username', [
'test_usr1',
'test_usr2',
])
def test_antigen_install_file(File, username):
antigen = File('/home/' + username + '/.antigen/antigen.zsh')
assert antigen.exists
assert antigen.is_file
assert antigen.user == username


@pytest.mark.parametrize('username', [
'test_usr1',
'test_usr2',
Expand Down
41 changes: 32 additions & 9 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,41 @@
with_items:
- git
- zsh
- tar

- name: clone antigen for users
tags:
# Suppress warning: [ANSIBLE0006] git used in place of git module
# Git module doesn't allow us to set `core.autocrlf=input`.
- skip_ansible_lint
- name: create download directory
file:
path: '{{ antigen_download_dir }}'
state: directory
mode: 'u=rwx,go=rx'

- name: download Antigen
get_url:
url: '{{ antigen_redis_mirror }}/{{ antigen_redis_filename }}'
dest: '{{ antigen_download_dir }}/{{ antigen_local_filename }}'
sha256sum: '{{ antigen_redis_sha256sum }}'
mode: 'u=rw,go=r'

- name: create install directory
become: yes
become_user: '{{ item.username }}'
command: 'git clone -c core.autocrlf=input --depth=1 https://github.com/zsh-users/antigen.git ~/.antigen'
args:
creates: '~{{ item.username }}/.antigen'
when: (item.antigen_libraries is defined) or (item.antigen_theme is defined) or (item.antigen_bundles is defined)
file:
path: '~{{ item.username }}/.antigen'
state: directory
mode: 'u=rwx,go=rx'
with_items: '{{ users }}'

- name: install Antigen
become: yes
unarchive:
src: '{{ antigen_download_dir }}/{{ antigen_local_filename }}'
remote_src: yes
dest: '~{{ item.username }}/.antigen'
extra_opts:
- '--strip-components=1'
creates: '~{{ item.username }}/.antigen/antigen.zsh'
owner: '{{ item.username }}'
mode: 'go-w'
with_items: '{{ users }}'

- name: install oh-my-zsh
Expand Down
10 changes: 9 additions & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
---
# vars file for ansible_role_antigen
# The root folder of this Antigen installation
antigen_home: '~/.antigen'

# File name for the Antigen redistributable installation file
antigen_redis_filename: 'v{{ antigen_version }}.tar.gz'

# Local file name for the Antigen redistributable installation file (needs to
# have the package name to avoid conflicts)
antigen_local_filename: 'antigen-{{ antigen_version }}.tar.gz'

0 comments on commit d0d4403

Please sign in to comment.