Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/// A protocol for downloading binary dependencies from git repositories.
protocol BinaryDependenciesDownloader {
/// Downloads the source code as a zip archive from the specified repo and release tag.
///
/// - Parameters:
/// - repo: Git repository, e.g. "owner/repo".
/// - tag: The release tag to download.
/// - outputFilePath: The output file path for the downloaded archive.
/// - Throws: If the download fails.
func downloadSourceCode(
repo: String,
tag: String,
outputFilePath: String
) throws
import Utils

/// A protocol for downloading binary dependencies from git repositories.
public protocol BinaryDependenciesDownloader {
/// Downloads a specific release asset from git repo matching the provided pattern.
///
/// - Parameters:
Expand Down
29 changes: 0 additions & 29 deletions Sources/Utils/CLI/CLI+GitHub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,6 @@ extension CLI.GitHub {
)
}

/// Downloads the source code as a zip archive from the specified repo and release tag using `gh`.
///
/// - Parameters:
/// - repo: GitHub repository, e.g. "owner/repo".
/// - tag: The release tag to download.
/// - outputFilePath: The output file path for the downloaded archive.
/// - Throws: If the download fails.
public func downloadSourceCode(
repo: String,
tag: String,
outputFilePath: String
) throws {
let arguments: [String] = [
["release"],
["download"],
["\(tag)"],
["--archive=zip"],
["--repo", "\(repo)"],
["--output", "\(outputFilePath)"]
].flatMap { $0 }

Logger.log("[Download] ⬇️ \(repo) source code with tag \(tag) to \(outputFilePath)")

try run(
arguments: arguments,
currentDirectoryURL: outputFilePath.asFileURL.deletingLastPathComponent()
)
}

/// Downloads a specific release asset from GitHub matching the provided pattern using `gh`.
///
/// - Parameters:
Expand Down