Created
November 28, 2017 12:34
-
-
Save colinbankier/5f5e5178424f749cf70e595520679920 to your computer and use it in GitHub Desktop.
Elchemy Find Deps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Elchemy.LocalDeps do | |
| def find!(dir), do: find!([], dir) | |
| def find!(dirs, dir) do | |
| files = dir |> File.ls! | |
| if Enum.member?(files, "mix.exs") do | |
| [dir | dirs] | |
| else | |
| files | |
| |> Enum.map(&Path.join(dir, &1)) | |
| |> Enum.filter(&File.dir?/1) | |
| |> Enum.reduce(dirs, &find!(&2, &1)) | |
| end | |
| end | |
| end | |
| Elchemy.LocalDeps.find!("elm-deps") | |
| |> Enum.map(fn path -> | |
| repo = path |> Path.split |> Enum.at(-2) |> String.to_atom | |
| {repo, path: path} | |
| end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment