-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add option to set shell executable
Covered in the following GitHub issue: #5
- Loading branch information
Showing
2 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,91 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Add plugin | ||
|
||
|
||
- name: "{{ asdf_plugin_name }} : Add plugin" | ||
when: asdf_plugin_shell_executable is undefined | ||
ansible.builtin.command: >- | ||
asdf plugin add {{ asdf_plugin_name }} {{ asdf_plugin_git_url }} | ||
register: task | ||
failed_when: task.rc >= 1 and 'already added' not in task.stderr | ||
changed_when: task.rc == 0 | ||
|
||
- name: "{{ asdf_plugin_name }} : Add plugin" | ||
when: asdf_plugin_shell_executable is defined | ||
ansible.builtin.shell: >- | ||
asdf plugin add {{ asdf_plugin_name }} {{ asdf_plugin_git_url }} | ||
args: {executable: "{{ asdf_plugin_shell_executable }}"} | ||
register: task | ||
failed_when: task.rc >= 1 and 'already added' not in task.stderr | ||
changed_when: task.rc == 0 | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# Checkout plugin repo at ref | ||
|
||
|
||
- name: "{{ asdf_plugin_name }} : Checkout plugin repo at ref" | ||
when: asdf_plugin_git_ref is defined | ||
when: asdf_plugin_shell_executable is undefined and asdf_plugin_git_ref is defined | ||
ansible.builtin.command: >- | ||
asdf plugin update {{ asdf_plugin_name }} {{ asdf_plugin_git_ref }} | ||
register: task | ||
failed_when: task.rc > 0 or 'fatal' in task.stdout or 'error' in task.stdout | ||
changed_when: false | ||
|
||
- name: "{{ asdf_plugin_name }} : Checkout plugin repo at ref" | ||
when: asdf_plugin_shell_executable is defined and asdf_plugin_git_ref is defined | ||
ansible.builtin.shell: >- | ||
asdf plugin update {{ asdf_plugin_name }} {{ asdf_plugin_git_ref }} | ||
args: {executable: "{{ asdf_plugin_shell_executable }}"} | ||
register: task | ||
failed_when: task.rc > 0 or 'fatal' in task.stdout or 'error' in task.stdout | ||
changed_when: false | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# Install package | ||
|
||
|
||
- name: "{{ asdf_plugin_name }} : Install package {{ asdf_plugin_package_versions | default('SKIP') }}" | ||
when: asdf_plugin_package_versions is defined | ||
when: asdf_plugin_shell_executable is undefined and asdf_plugin_package_versions is defined | ||
ansible.builtin.command: >- | ||
asdf install {{ asdf_plugin_name }} {{ item }} | ||
loop: "{{ asdf_plugin_package_versions }}" | ||
register: task | ||
failed_when: task.rc > 0 | ||
changed_when: false | ||
|
||
- name: "{{ asdf_plugin_name }} : Set the global version to {{ asdf_plugin_package_version_global | default('SKIP') }}" | ||
when: asdf_plugin_package_version_global is defined | ||
- name: "{{ asdf_plugin_name }} : Install package {{ asdf_plugin_package_versions | default('SKIP') }}" | ||
when: asdf_plugin_shell_executable is defined and asdf_plugin_package_versions is defined | ||
ansible.builtin.shell: >- | ||
asdf install {{ asdf_plugin_name }} {{ item }} | ||
loop: "{{ asdf_plugin_package_versions }}" | ||
args: {executable: "{{ asdf_plugin_shell_executable }}"} | ||
register: task | ||
failed_when: task.rc > 0 | ||
changed_when: false | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# Set the global version | ||
|
||
|
||
- name: "{{ asdf_plugin_name }} : Set global version to {{ asdf_plugin_package_version_global | default('SKIP') }}" | ||
when: asdf_plugin_shell_executable is undefined and asdf_plugin_package_version_global is defined | ||
ansible.builtin.command: >- | ||
asdf global {{ asdf_plugin_name }} {{ asdf_plugin_package_version_global }} | ||
register: task | ||
failed_when: task.rc > 0 | ||
changed_when: false | ||
|
||
- name: "{{ asdf_plugin_name }} : Set global version to {{ asdf_plugin_package_version_global | default('SKIP') }}" | ||
when: asdf_plugin_shell_executable is defined and asdf_plugin_package_version_global is defined | ||
ansible.builtin.shell: >- | ||
asdf global {{ asdf_plugin_name }} {{ asdf_plugin_package_version_global }} | ||
args: {executable: "{{ asdf_plugin_shell_executable }}"} | ||
register: task | ||
failed_when: task.rc > 0 | ||
changed_when: false | ||
|
||
|
||
# ------------------------------------------------------------------------------ |