Skip to content

Instantly share code, notes, and snippets.

@jsatk
Last active June 29, 2019 04:07
Show Gist options
  • Save jsatk/8bb03a96dda00ce7a85089da01e05d89 to your computer and use it in GitHub Desktop.
Save jsatk/8bb03a96dda00ce7a85089da01e05d89 to your computer and use it in GitHub Desktop.
Small part of my makefile that is bad.
# asdf --------------------------------------------------------------------- {{{
# TODO: This is horrible. Do this in a loop and stash the results of `asdf
# plugin-list` so you only have to call it once.
node_installed := $(shell [[ "$(shell asdf plugin-list)" == *nodejs* ]] && echo 0 || echo 1)
ruby_installed := $(shell [[ "$(shell asdf plugin-list)" == *ruby* ]] && echo 0 || echo 1)
golang_installed := $(shell [[ "$(shell asdf plugin-list)" == *golang* ]] && echo 0 || echo 1)
rust_installed := $(shell [[ "$(shell asdf plugin-list)" == *rust* ]] && echo 0 || echo 1)
python_installed := $(shell [[ "$(shell asdf plugin-list)" == *python* ]] && echo 0 || echo 1)
.PHONY: asdf
asdf: | ## Install specific verions of languages -- language versions specified in ~/.tool-versions.
ifeq ($(node_installed), 1)
asdf plugin-add nodejs
endif
ifeq ($(ruby_installed), 1)
asdf plugin-add ruby
endif
ifeq ($(golang_installed), 1)
asdf plugin-add golang
endif
ifeq ($(rust_installed), 1)
asdf plugin-add rust
endif
ifeq ($(python_installed), 1)
asdf plugin-add python
endif
asdf install
# }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment