From 4036f63eb4f3703345d67c809ba753e1a198c15c Mon Sep 17 00:00:00 2001 From: MichaelHatherly Date: Tue, 23 Apr 2024 09:38:09 +0100 Subject: [PATCH] Allow `artifacts_url` to be passed as a keyword --- src/PackageBundler.jl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/PackageBundler.jl b/src/PackageBundler.jl index 1325a72..1d11838 100644 --- a/src/PackageBundler.jl +++ b/src/PackageBundler.jl @@ -104,7 +104,11 @@ listed below. The valid names for handlers are: - `code_injector.jl`: A function that injects extra code into the bundled packages. Takes `filename` as an argument. """ -function bundle(config::AbstractString = "PackageBundler.toml"; clean::Bool = false) +function bundle( + config::AbstractString = "PackageBundler.toml"; + clean::Bool = false, + artifacts_url::Union{String,Nothing} = nothing, +) config = abspath(config) endswith(config, ".toml") || error("Config file must be a TOML file: `$config`.") isfile(config) || error("Config file not found: `$config`.") @@ -165,7 +169,7 @@ function bundle(config::AbstractString = "PackageBundler.toml"; clean::Bool = fa outputs = isempty(outputs) ? [name] : outputs # Artifact URL for `Artifacts.toml` files. - artifact_url = get(config, "artifacts_url", nothing)::Union{String,Nothing} + artifacts_url = get(config, "artifacts_url", artifacts_url)::Union{String,Nothing} # Multiplexers. The list of multiplexer programs to try to use to select # specific versions of Julia for each environment based on it's @@ -220,7 +224,7 @@ function bundle(config::AbstractString = "PackageBundler.toml"; clean::Bool = fa close(tar) elseif is_artifacts @info "Generating Artifacts.toml bundle." output - if isnothing(artifact_url) + if isnothing(artifacts_url) error("`artifacts_url` must be specified for Artifacts.toml output.") end artifact_toml = joinpath(temp_dir, "Artifacts.toml") @@ -235,7 +239,7 @@ function bundle(config::AbstractString = "PackageBundler.toml"; clean::Bool = fa name, product_hash, force = true, - download_info = Tuple[("$artifact_url/$artifact_name", download_hash)], + download_info = Tuple[("$artifacts_url/$artifact_name", download_hash)], ) if clean && isdir(dirname(output)) @warn "Cleaning directory." dirname(output)