Questions tagged [elixir-mix]

Mix is a build tool that provides tasks for creating, compiling, testing Elixir projects, as well as handle dependencies, and more.

339 questions
4
votes
1 answer

Handling configuration values in mix

I am currently struggling to handle config values in mix (particularly when running tests). This is my scenario: i have a client library, with some common config values (key, secret, region). i want to test what happens when there's no region value…
sixFingers
  • 1,285
  • 8
  • 13
4
votes
1 answer

How to create a Mix task at the root of an umbrella project?

I have an Elixir umbrella project. Each apps in this project can be compiled into executable file using mix escript.build. I am trying to run this command from the root of umbrella project and got the following error ** (RuntimeError) Trying to…
Navaneeth K N
  • 15,295
  • 38
  • 126
  • 184
4
votes
1 answer

IEx - run Mix "test" task

I get a bit tired of switching between Tmux panes so I'm trying to just work with vim and iex rather than entering mix commands into another console. With that goal in mind, I enter the following into the iex console but my tests don't appear to…
4
votes
1 answer

How to run 'mix' commands on a release (elixir/exrm)?

Working on an application built with Elixir/mix. We have a bunch of utility functions (i.e.: seed/clear Mnesia db) which we run as elixir mix foo. Once a release is built (with mix + exrm), and deployed on a target machine (where we do not expect…
4
votes
1 answer

Cannot compile simple Elixir Project

I´am working my way through ´Programming Elixir´ by Dave Thomas. I now hit the point where you create your first mix project. HTTPoison was just introduced and added to the application function in the mix.exs. Now the project should be compiled the…
Robert Krauß
  • 65
  • 1
  • 8
4
votes
1 answer

How to run tests with mix

Update: for anyone arriving at this question from Google, you can run the tests of a given Elixir project by running mix test. As per the docs, Elixir Script Files (with an extension of .exs) do not need to be compiled before they are ran. Here is…
user2993456
4
votes
1 answer

Different vendor file for production and development

I'm using Phoenix 0.14.0 and I'm planning to use reactjs to create the user interface. The way I'm doing this is just putting the react.min.js in the web/static/vendor folder. The thing is, I want that in development the non-minified version of…
diogovk
  • 2,108
  • 2
  • 19
  • 24
4
votes
1 answer

Should I use Mix.Utils in my elixir code?

I need to get a file by URL and store it on the local disk. I see that Mix.Utils has: copy_path!(source, target, opts \\ []) Which seems to do exactly what I want, but is Mix.Utils only something you'd use for writing mix tasks and not for general…
TheStoneFox
  • 3,007
  • 3
  • 31
  • 47
4
votes
1 answer

Loading mix dependencies marked as test only when the MIX_ENV was not originally set to "test"

I wish to programmatically run the mix test task within my Elixir application. This can be done with Mix.Tasks.Test.run/1, though attempting to do so without first setting the MIX_ENV environmental variable results in the task refusing to run. We…
lpil
  • 1,702
  • 1
  • 12
  • 22
4
votes
1 answer

Elixir application with multiple/dynamic config files

I have an elixir application, an application server, that would benefit from start up parameters. This application uses an ecto repository, so I can store an app server's configuration there, but I'd still need a configuration key for what to…
SolomonS
  • 227
  • 3
  • 9
4
votes
4 answers

Can't get the environment variables in Elixir project

I defined a environment variable related to the guide-started, my mix.exs is defmodule Basic.Mixfile do use Mix.Project def project do [app: :basic, version: "0.0.1", elixir: "~> 0.13.0-dev", deps: deps, env: [ …
jsvisa
  • 2,987
  • 2
  • 24
  • 30
3
votes
2 answers

Elixir release inside Docker container without Rabbit MQ Connection

I am very new to Elixir. I have built an app which runs locally, which works fine. But now i need to build a container for it with Docker. However, every attempt to do a release seems to try and connection to RabbitMQ (which is running locally, as a…
C0ol_Cod3r
  • 909
  • 2
  • 15
  • 35
3
votes
1 answer

Elixir custom task does not show up on "mix help"

Is the following code not enough to list a custom task on mix help? defmodule Mix.Tasks.Start do use Mix.Task @shortdoc "Starts [App]" def run(_) do IO.puts("Starting [App]...") end end I thought that the decorator @shortdoc was enough…
Jeff Pal
  • 1,519
  • 1
  • 17
  • 28
3
votes
1 answer

Get elixir mix release version in application

I have the following mix.exs defmodule App.MixProject do use Mix.Project @version "0.1.0" def git_ref(), do: System.get_git_hash() def project do [ app: :app, version: @version, ... releases: [ app: fn…
3
votes
1 answer

When we should use defmodule in .exs file

I tried creating a mix project it did not have the config.exs so I created the file. I referred config.exs from a phoenix project. I see the config.exs does not have module definition. I tried declaring a standalone function in a .ex file it raised…
Yugandhar Chaudhari
  • 3,831
  • 3
  • 24
  • 40