Elixir mix auto acknowledge

无人久伴 提交于 2019-12-21 08:17:59

问题


I want to run tests of my Phoenix app on Travis-CI.

Log excerpt:

$ MIX_ENV=test mix do deps.get, compile, test

Could not find hex, which is needed to build dependency :phoenix

Shall I install hex? [Yn] 

When it comes to fetching and installing dependencies, it asks if it should install hex. I was wondering if I can pass a --yes option to mix so that it doesn't ask but just installs?


回答1:


As with any unix command, you could pipe yes into the mix command:

yes | MIX_ENV=test mix do deps.get, compile, test



回答2:


You can add this command to your before_install section in .travis.yml

  • mix local.hex --force

After of course, you've already installed elixir in a previous command. I cargo culted this .travis.yml from an existing elixir project on github.

language: erlang
env:
  - ELIXIR="v1.0.0"
otp_release:
  - 17.1
before_install:
  - mkdir -p vendor/elixir
  - wget -q https://github.com/elixir-lang/elixir/releases/download/$ELIXIR/Precompiled.zip && unzip -qq Precompiled.zip -d vendor/elixir
  - export PATH="$PATH:$PWD/vendor/elixir/bin"
  - mix local.hex --force
script: "MIX_ENV=test mix do deps.get, test"


来源:https://stackoverflow.com/questions/25911361/elixir-mix-auto-acknowledge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!