wand_core v0.2.0 WandCore.WandFile

Module describing the internal state of a wand file, along with helper functions to manipulate the dependencies and serialize the module to disk.

Wand.json

The format for wand.json looks like this:

{
  "version": 1.0.0,
  "dependencies": {
    "dependency_name': dependency,
  }
}

A dependency can have the following serialized formats in wand.json:

Simple dependency

The value can be a string of the version requirement: "poison": "~> 3.1.0".

Dependency with just opts

If, say, pulling from git, the value can be just a map of options: "poison": {"git": "https://github.com/devinus/poison.git"}

Dependency with a version and opts

Lastly, a dependency can be a list of [requirement, opts]. For example: "poison": ["~> 3.1.0", {"only": ":test"}

Link to this section Summary

Functions

Add a new Dependency to a WandFile, unless the name already exists in the file

Load a wand.json file from disk, and parse it into a WandFile

Remove a dependency to a WandFile by name. Returns the file (always succeeds)

Save the WandFile as a JSON file to the path indicated

Link to this section Types

Link to this type error()
error() :: {:error, any()}
Link to this type success()
success() :: {:ok, t()}
Link to this type success_or_error()
success_or_error() :: success() | error()
Link to this type t()
t() :: %WandCore.WandFile{
  dependencies: %{optional(atom()) => WandCore.WandFile.Dependency.t()},
  version: String.t()
}

Link to this section Functions

Add a new Dependency to a WandFile, unless the name already exists in the file

Link to this function load(path \\ "wand.json")
load(Path.t()) :: success_or_error()

Load a wand.json file from disk, and parse it into a WandFile

Link to this function remove(file, name)

Remove a dependency to a WandFile by name. Returns the file (always succeeds)

Link to this function save(file, path \\ "wand.json")
save(t(), Path.t()) :: :ok | error()

Save the WandFile as a JSON file to the path indicated.