mirror of
https://github.com/bonfire-networks/bonfire-app.git
synced 2024-05-18 00:52:40 +00:00
d
This commit is contained in:
parent
733c783659
commit
f9cec83b5e
|
@ -5,11 +5,24 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
if not Code.ensure_loaded?(Mess) do
|
||||
defmodule Mess do
|
||||
@moduledoc """
|
||||
Helper for using dependencies specified in simpler text files in an Elixir mix project.
|
||||
"""
|
||||
@newline ~r/(?:\r\n|[\r\n])/
|
||||
@parser ~r/^(?<indent>\s*)((?<package>[a-z_][a-z0-9_]+)\s*=\s*"(?<value>[^"]+)")?(?<post>.*)/
|
||||
@git_branch ~r/(?<repo>[^#]+)(#(?<branch>.+))?/
|
||||
@ext_forks_path System.get_env("FORKS_PATH", "extensions/")
|
||||
|
||||
@doc "Takes a list of sources and an extra list of dependencies, and returns a new list of unique dependencies that include the packages specified in the sources. The sources list specifies where to find the list(s) of dependencies (if none are specified default paths are used, see `sources/1`). Each source is a keyword list of a source type and the path to the file where those type of dependencies are specified. The possible source types are path, git, and hex."
|
||||
def deps(sources \\ nil, extra_deps, opts \\ []) do
|
||||
opts = opts(opts)
|
||||
|
||||
(sources || sources(opts[:use_local_forks?]))
|
||||
# |> IO.inspect()
|
||||
|> enum_deps()
|
||||
|> deps_packages(extra_deps, opts)
|
||||
end
|
||||
|
||||
defp sources(true), do: [path: "deps.path", git: "deps.git", hex: "deps.hex"]
|
||||
defp sources(_), do: [git: "deps.git", hex: "deps.hex"]
|
||||
|
||||
|
@ -36,15 +49,6 @@ if not Code.ensure_loaded?(Mess) do
|
|||
# |> IO.inspect(label: "opts for #{File.cwd!}")
|
||||
end
|
||||
|
||||
def deps(sources \\ nil, extra_deps, opts \\ []) do
|
||||
opts = opts(opts)
|
||||
|
||||
(sources || sources(opts[:use_local_forks?]))
|
||||
# |> IO.inspect()
|
||||
|> enum_deps()
|
||||
|> deps_packages(extra_deps, opts)
|
||||
end
|
||||
|
||||
defp enum_deps({k, v}) do
|
||||
read(v, k)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue