The first line loads the dependencies we require. That’s the whole script! Pretty small isn’t it? Then paste in the following content: Mix.install([ Using your preferred code editor, create a new file. Now we can continue to use our favorite language to do simple scripts like this. Previously, we’d have no choice but to create a mix project or we may just turn to a different tool to solve our need. But we want to use libraries to help do the work. Doing something so simple doesn’t make sense to create a whole mix project. We want to return all the repositories under the elixir-lang organization. We are set! Using Mix.install/2 in an Elixir Scriptįor this example, let’s say we want to write a quick script that can grab some information from Github. $ elixir -vĮrlang/OTP 24 Įlixir 1.12.0 (compiled with Erlang/OTP 24) Let’s make sure we are using the correct Elixir version. Make sure to activate this newly installed version! Again, here I’m making it the global default. => Checking whether specified Elixir release exists. Near the end of the list I find this entry: 1.12.0-otp-24. I need to make sure I’m installing the correct version that is intended for OTP 24. $ asdf global erlang 24.0.1 Install Elixir I’m going to make this my new global default. Globally means it becomes the default version to use from a terminal when running commands. So when you run a terminal command from that directory, it will use the version you specified. Activate globally with:Īctivate locally in the current folder with:Īctivate the new version either locally or globally. $ asdf install erlang 24.0.1Īsdf_24.0.1 is not a kerl-managed Erlang/OTP installationĭownloading OTP-24.0.1.tar.gz to /home/mark/.asdf/plugins/erlang/kerl-home/archives. I found “24.0.1” as the latest version for OTP 24. Let’s make sure we’re installing the latest OTP version of Erlang, I run the following command. $ asdf plugin-update -all Install Erlang OTP 24 Since we are going to update Elixir and Erlang, let’s just make sure our asdf plugins for those languages are up-to-date as well. Update asdfįirst, make sure your asdf version is up-to-date. This makes it easier to test upgrade your Elixir project while still switching back to your “production version” when needed. It helps you manage and use multiple versions of Elixir, Erlang, Node, Ruby, and a lot more too. When you are working with production Elixir applications, sometimes you can’t upgrade the version of Elixir (or Erlang) that you’re using because of things like platform constraints, libraries that need to updated, or deprecation warnings that need to be cleaned up first.Īsdf is a great tool for situations like that.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |