Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
feat(ASDF): add custom cmd directly before install
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Feb 10, 2023
1 parent dcc2cff commit 3749d36
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Each plugin should be configured in the following format:
asdf_plugins:
- name: "erlang" # a plugin name
environment: {} # an optional dictionary of environment variables for build configuration
pre_install: "" # an optional command to run directly before the installation (i.e. select a Python Interpreter for compilation)
repository: "" # a plugin repository, optional
versions: # a list of versions to install
- 23.3.3
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ asdf_plugins: []
# asdf_plugins:
# - name: "erlang"
# environment_variables: {} (Optional key to specify environment specific information for OSX builds.)
# pre_install: "" (Optional setup command to run before installation, i.e. select a Python version for compilation.)
# repository: ""
# versions:
# - 18.3
Expand Down
11 changes: 11 additions & 0 deletions molecule/common/tasks/verify_pre_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Check that pre_install was executed
stat:
path: "{{ asdf_user_home }}/pre_install_test"
register: pre_install_test

- name: Assert pre_install_test was executed
assert:
that:
- pre_install_test.stat.exists
msg: "The pre_install_test file must have been created."
1 change: 1 addition & 0 deletions molecule/nodejs/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ asdf_legacy_version_file: "yes"
asdf_plugins:
- name: "nodejs"
repository: ""
pre_install: "touch ~/pre_install_test"
versions:
- 14.0.0
global: 14.0.0
3 changes: 3 additions & 0 deletions molecule/nodejs/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@

- name: Verify the correct version was Installed
include_tasks: "../common/tasks/verify_binary.yml"

- name: Verify the pre_install command executed
include_tasks: "../common/tasks/verify_pre_install.yml"
2 changes: 1 addition & 1 deletion tasks/plugins_darwin/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
- name: Install asdf Apps
become: True
become_user: "{{ asdf_user }}"
shell: "source {{ asdf_source }}; asdf install {{ item.0.name }} {{ item.1 }}"
shell: "source {{ asdf_source }}; {{ item[0]['pre_install'] | default(':') }}; asdf install {{ item.0.name }} {{ item.1 }}"
environment: "{{ item[0]['environment'] | default({}) }}"
args:
chdir: "{{ asdf_user_home }}"
Expand Down

0 comments on commit 3749d36

Please sign in to comment.