diff --git a/README.md b/README.md index e5c8cee..bc982ff 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index 90964f7..9c2b71d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/molecule/common/tasks/verify_pre_install.yml b/molecule/common/tasks/verify_pre_install.yml new file mode 100644 index 0000000..6c3d9c2 --- /dev/null +++ b/molecule/common/tasks/verify_pre_install.yml @@ -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." diff --git a/molecule/nodejs/vars/main.yml b/molecule/nodejs/vars/main.yml index a458879..8029e43 100644 --- a/molecule/nodejs/vars/main.yml +++ b/molecule/nodejs/vars/main.yml @@ -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 diff --git a/molecule/nodejs/verify.yml b/molecule/nodejs/verify.yml index b461d80..277d62e 100644 --- a/molecule/nodejs/verify.yml +++ b/molecule/nodejs/verify.yml @@ -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" diff --git a/tasks/plugins_darwin/main.yml b/tasks/plugins_darwin/main.yml index e837a71..2a45397 100644 --- a/tasks/plugins_darwin/main.yml +++ b/tasks/plugins_darwin/main.yml @@ -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 }}"