Skip to content

Instantly share code, notes, and snippets.

@vic
Last active June 30, 2017 14:41
Show Gist options
  • Save vic/f4d8ef0c1d3232c7591e1ef80e31a082 to your computer and use it in GitHub Desktop.
Save vic/f4d8ef0c1d3232c7591e1ef80e31a082 to your computer and use it in GitHub Desktop.
asdf install order

asdf installation order

This small gist contains to fake asdf-plugins to help me ensure installation order and if tools get activated at installation time for subsequent tools, that is, given the following .tool-versions file:

a foo
b bar

asdf install should first install a with version foo and then install b with version bar which actually uses a to create the b executable.

Usage

# install these two fake plugins
mkdir -p ~/.asdf/plugins/a/bin ~/.asdf/plugins/b/bin
cp a_install ~/.asdf/plugins/a/bin/install
cp b_install ~/.asdf/plugins/b/bin/install
chmod 755 ~/.asdf/plugins/{a,b}/bin/install


# request foo and bar versions of a and b
mkdir /tmp/project-x
cd /tmp/project-x
cat <<EOF > .tool-versions
a foo
b bar
EOF
asdf install
b # should print that it was installed by a-foo

# request baz and bat versions of a and b
mkdir /tmp/project-y
cd /tmp/project-y
cat <<EOF >.tool-versions
a baz
b bat
EOF
asdf install
b # should print that it was installed by a-baz


# cleanup
asdf uninstall a
asdf uninstall b
rm -rf ~/.asdf/plugins/a ~/.asdf/plugins/b
mkdir -p $ASDF_INSTALL_PATH/bin
cat <<EOF > $ASDF_INSTALL_PATH/bin/a
#!/usr/bin/env bash
cat <<FIN
#!/usr/bin/env bash
echo \${*} installed by a-$ASDF_INSTALL_VERSION
FIN
EOF
chmod 755 $ASDF_INSTALL_PATH/bin/a
mkdir -p $ASDF_INSTALL_PATH/bin
a b-$ASDF_INSTALL_VERSION > $ASDF_INSTALL_PATH/bin/b
chmod 755 $ASDF_INSTALL_PATH/bin/b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment