Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow artifacts_url to be passed as a keyword #22

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/PackageBundler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`.")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand Down
Loading