diff --git a/.mash.exs b/.mash.exs index ba66dc3..fc57bd1 100644 --- a/.mash.exs +++ b/.mash.exs @@ -12,7 +12,7 @@ defmodule MashConfig do %{ name: :compile_dev, needs: [:restore_cache], - run: mix("compile", [], env: [{"MIX_ENV", "dev"}]) + run: mix("do", ["deps.compile,", "compile"], env: [{"MIX_ENV", "dev"}]) }, %{ name: :test, @@ -26,7 +26,7 @@ defmodule MashConfig do }, %{ name: :save_cache, - needs: [:test, :compile_dev], + needs: [:restore_cache], run: save_cache() }, %{ diff --git a/README.md b/README.md index 50c99cd..7864448 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Add mash to your dependencies like so: ```elixir def deps do [ - {:mash, "~> 0.1.1"} + {:mash, "~> 0.1.2"} ] end ``` diff --git a/lib/mash/helpers.ex b/lib/mash/helpers.ex index 4b05557..787add6 100644 --- a/lib/mash/helpers.ex +++ b/lib/mash/helpers.ex @@ -15,10 +15,19 @@ defmodule Mash.Helpers do mix_env = Enum.find_value(env, fn {key, value} -> key == "MIX_ENV" && value end) || - Atom.to_string(Mix.Task.preferred_cli_env(task_name)) || - Atom.to_string(Mix.env()) || + Mix.Task.preferred_cli_env(task_name) || + Mix.env() || :dev + mix_env = + case mix_env do + env when is_binary(env) -> + env + + env -> + Atom.to_string(env) + end + fn io_pid -> cmd("mix", [task_name | args], io_pid, [{"MIX_ENV", mix_env} | env]) end @@ -74,9 +83,9 @@ defmodule Mash.Helpers do end defp cmd(command, args, io_pid, env) do - exec_string = "-c #{command} #{Enum.join(args, " ")}" + exec_string = ~s(-c #{command} #{Enum.join(args, " ")}) - System.cmd("script", ["-eqf", exec_string, "/dev/null"], + System.cmd("script", ["/dev/null", "-eqf", exec_string], into: IO.stream(io_pid, :line), env: env, parallelism: true, diff --git a/mix.exs b/mix.exs index f926947..fb5ae5e 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Mash.MixProject do def project do [ app: :mash, - version: "0.1.1", + version: "0.1.2", elixir: "~> 1.14", start_permanent: Mix.env() == :prod, deps: deps(),