clyde icon indicating copy to clipboard operation
clyde copied to clipboard

Add a way to define custom fetchers

Open agateau opened this issue 3 years ago • 0 comments

Goal

Make it possible to fetch updates for packages not hosted on GitHub.

Syntax

New fetch entry in the package file:

fetch:
    type: auto|github|gitlab|script|none # defaults to auto
    # fetch type specific entries

auto fetcher

Loops on all fetchers, if one of them says it supports the repository, use it. Otherwise, use none.

github fetcher

Uses GitHub API to fetch releases.

gitlab fetcher

Uses GitLab API to fetch releases.

script fetcher

Runs "$package_dir/fetch". Must be a standalone script.

Must print JSON:

{
    "version": $str,
    "assets": {
        "$arch_os": "$url"
    }
}

Implementation steps

  • [x] Implement GitLab fetcher
  • [x] Introduce a Fetcher trait:
trait Fetcher {
    fn can_fetch(package: &Package) -> bool;
    fn fetch(ui: &Ui, package: &Package) -> Result<UpdateStatus>;
}
  • [ ] Add support for the fetch.type entries to the package format.
  • [ ] Implement script fetcher.

agateau avatar Nov 30 '22 13:11 agateau