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

Support not only 'latest' releases #32

Closed
6 tasks
chshersh opened this issue Aug 26, 2022 · 0 comments · Fixed by #61
Closed
6 tasks

Support not only 'latest' releases #32

chshersh opened this issue Aug 26, 2022 · 0 comments · Fixed by #61
Labels
config TOML configuration, config-related CLI options enhancement New feature or request good first issue Good for newcomers

Comments

@chshersh
Copy link
Owner

chshersh commented Aug 26, 2022

Currently tool-sync downloads the latest release by default. I can imagine some people preferring specific releases. This should be easily supported by tool-sync with a few code changes:

  • Add the tag field to ConfigAsset
    • /// Additional details, telling how to download a tool
      #[derive(Debug, PartialEq, Eq)]
      pub struct ConfigAsset {
      /// GitHub repository author
      pub owner: Option<String>,
      /// GitHub repository name
      pub repo: Option<String>,
      /// Executable name inside the .tar.gz or .zip archive
      /// Defaults to `repo` if not specified
      pub exe_name: Option<String>,
      /// Name of the specific asset to download
      pub asset_name: AssetName,
      }
  • Patch TOML decoding
    • fn decode_config_asset(table: &Map<String, Value>) -> ConfigAsset {
      let owner = str_by_key(table, "owner");
      let repo = str_by_key(table, "repo");
      let exe_name = str_by_key(table, "exe_name");
      let asset_name = decode_asset_name(table);
      ConfigAsset {
      owner,
      repo,
      exe_name,
      asset_name,
      }
      }
  • Update the ToolInfo to store a value of a new enum with constructors Latest or Tag
    • /// All info about installing a tool from GitHub releases
      #[derive(Debug, PartialEq, Eq)]
      pub struct ToolInfo {
      /// GitHub repository author
      pub owner: String,
      /// GitHub repository name
      pub repo: String,
      /// Executable name inside the .tar.gz or .zip archive
      pub exe_name: String,
      /// Asset name depending on the OS
      pub asset_name: AssetName,
      }
  • Patch configure.rs to apply ConfigAsset settings
  • Update release_url to return not only the latest release
    • fn release_url(&self) -> String {
      format!(
      "https://api.github.com/repos/{owner}/{repo}/releases/latest",
      owner = self.owner,
      repo = self.repo
      )
      }
  • Add tests
@chshersh chshersh added enhancement New feature or request config TOML configuration, config-related CLI options good first issue Good for newcomers labels Aug 26, 2022
@chshersh chshersh added this to the v0.2.0: Improved sync milestone Aug 30, 2022
@chshersh chshersh pinned this issue Sep 2, 2022
FrancisMurillo pushed a commit to FrancisMurillo/tool-sync that referenced this issue Sep 3, 2022
FrancisMurillo added a commit to FrancisMurillo/tool-sync that referenced this issue Sep 3, 2022
FrancisMurillo added a commit to FrancisMurillo/tool-sync that referenced this issue Sep 3, 2022
FrancisMurillo added a commit to FrancisMurillo/tool-sync that referenced this issue Sep 3, 2022
@chshersh chshersh unpinned this issue Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config TOML configuration, config-related CLI options enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant