OhMyArtifacts

Documentation for OhMyArtifacts.

OhMyArtifacts.bind_my_artifact!Method
bind_my_artifact!(artifacts_toml::String, name::AbstractString, hash::SHA256; force::Bool = false, metadata = nothing)

Writes a mapping of name -> hash in the given "Artifacts.toml" file and track the usage. If force is set to true, this will overwrite a pre-existant mapping, otherwise an error is raised. By setting metadata, we can store extra information in the artifacts_toml with field name meta of name entry.

source
OhMyArtifacts.create_my_artifactMethod
create_my_artifact(f::Function)

Create artifact by calling f(working_dir). f is the function that create/put/download file(s) into the working_dir. f should either return the path to the file/directory or return nothing. If f return nothing, then everything in working_dir would be cached. If f return a path, that path must be inside working_dir.

source
OhMyArtifacts.download_my_artifact!Method
download_my_artifact!([downloadf::Function = Downloads.download], url, name::AbstractString, artifacts_toml::String;
                     force_bind::Bool = false, bind_metadata = nothing, downloadf_kwarg...)

Convenient function that do download-create-bind together and return the content hash. Download function downloadf should take two position arguments (i.e. downloadf(url, dest; downloadf_kwarg...)). if force_bind is true, it will overwrite the pre-existant binding.

See also: createmyartifact, bindmyartifact!

source
OhMyArtifacts.initMethod
init()

Initialize the storage space.

Generally you don't have to manually call this function. It would be called everytime you call my_artifacts_toml!. This function would setup the scratch space we need, check if we need to recycle some storages.

source
OhMyArtifacts.my_artifact_hashMethod
my_artifact_hash(name::AbstractString, artifacts_toml::String)

Return the hash found in artifacts_toml with given name, or nothing if not found.

source
OhMyArtifacts.my_artifacts_toml!Method
my_artifacts_toml!(pkg::Union{Module,Base.UUID,Nothing}; versioned = false)

Return the path to (or creates) "Artifacts.toml" for the given pkg. If versioned is set to true, we get a separate "Artifacts_<version number>.toml".

See also: @my_artifacts_toml!

source
OhMyArtifacts.unbind_my_artifact!Method
unbind_my_artifact!(artifacts_toml::String, name::AbstractString)

Unbind the given name from the "Artifacts.toml" file. Silently fails if no such binding exists within the file.

source
OhMyArtifacts.@my_artifactMacro
@my_artifact op name [hash]

Convenient macro for working with "Artifacts.toml". Requiring a global variable my_artifacts storing the path to "Artifacts.toml" (created by @my_artifacts_toml!) to work correctly.

Usage:

  1. @my_artifact :bind name hash => bind_my_artifact!(my_artifacts, name, hash)
  2. @my_artifact :hash name => my_artifact_hash(name, my_artifacts)
  3. @my_artifact :unbind name => unbind_my_artifact!(my_artifacts, name)
  4. @my_artifact :download name url downloadf kwarg... => download_my_artifact!(downloadf, url, name, my_artifacts; kwarg...)

See also: bind_my_artifact!, my_artifact_hash, unbind_my_artifact!, @my_artifacts_toml

source