From 0d74c0c0f207b4350ab47a47599c81eae8587ba2 Mon Sep 17 00:00:00 2001 From: Peter Damoc Date: Thu, 5 Dec 2019 12:26:16 +0200 Subject: [PATCH] Changed install of dependencies to use elm-json, fixes #121 --- lib/elm/platform/local_19.ex | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/elm/platform/local_19.ex b/lib/elm/platform/local_19.ex index 25580d8a..94736f49 100644 --- a/lib/elm/platform/local_19.ex +++ b/lib/elm/platform/local_19.ex @@ -6,6 +6,8 @@ defmodule Elm.Platform.Local19 do alias Elm.Version require Logger + @elm_json_binary System.cmd("which", ["elm-json"]) |> elem(0) |> String.trim() + @spec setup(Path.t()) :: {:ok, Project.t()} | :error def setup(root) do with :ok <- elm_init(root) do @@ -121,13 +123,13 @@ defmodule Elm.Platform.Local19 do :ok [head | tail] -> - binary = Path.join(base_path(), "elm") - package = "#{head.name.user}/#{head.name.project}" - args = ["install", package] + package = "#{head.name.user}/#{head.name.project}@#{Elm.Version.to_string(head.version)}" + + args = ["install", "--yes", package] options = [out: :string, err: :string, dir: root, in: "Y"] result = - case Porcelain.exec(binary, args, options) do + case Porcelain.exec(@elm_json_binary, args, options) do %Porcelain.Result{status: 0} -> install_missing_deps(root, tail)