Skip to content

Commit

Permalink
actionlint.rs alphavet.rs deadcode.rs depth.rs dprint.rs exhaustruct.…
Browse files Browse the repository at this point in the history
…rs gh.rs ghokin.rs go.rs goda.rs gofmt.rs gofumpt.rs golangci_lint.rs goreleaser.rs govulnchec.rs ireturn.rs mdbook.rs mdbook_linkcheck.rs mod.rs node_prune.rs nodejs.rs npm.rs npx.rs ripgrep.rs scc.rs shellcheck.rs shfmt.rs staticcheck.rs tikibase.rs requested_version.rs mod.rs run_method.rs
  • Loading branch information
kevgo committed Feb 18, 2025
1 parent ca3a6f7 commit f414d45
Show file tree
Hide file tree
Showing 32 changed files with 233 additions and 198 deletions.
12 changes: 6 additions & 6 deletions src/applications/actionlint.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{AnalyzeResult, AppDefinition};
use crate::configuration::Version;
use crate::executables::{self, Executable};
use crate::executables::{self, Executable, RunMethod};
use crate::hosting::github_releases;
use crate::installation::{BinFolder, Method};
use crate::platform::{Cpu, Os, Platform};
Expand All @@ -26,7 +26,7 @@ impl AppDefinition for ActionLint {
github_releases::latest(ORG, REPO, log)
}

fn run_method(&self, version: &Version, platform: Platform) -> executables::Method {
fn run_method(&self, version: &Version, platform: Platform) -> RunMethod {
let cpu = match platform.cpu {
Cpu::Arm64 => "arm64",
Cpu::Intel64 => "amd64",
Expand All @@ -40,7 +40,7 @@ impl AppDefinition for ActionLint {
Os::Linux | Os::MacOS => "tar.gz",
Os::Windows => "zip",
};
executables::Method::ThisApp {
RunMethod::ThisApp {
install_methods: vec![
Method::DownloadArchive {
url: format!("https://github.com/{ORG}/{REPO}/releases/download/v{version}/actionlint_{version}_{os}_{cpu}.{ext}"),
Expand Down Expand Up @@ -86,7 +86,7 @@ mod tests {
use crate::applications::actionlint::ActionLint;
use crate::applications::AppDefinition;
use crate::configuration::Version;
use crate::executables;
use crate::executables::RunMethod;
use crate::installation::{BinFolder, Method};
use crate::platform::{Cpu, Os, Platform};
use big_s::S;
Expand All @@ -100,7 +100,7 @@ mod tests {
cpu: Cpu::Arm64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![
Method::DownloadArchive {
url: S("https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_linux_arm64.tar.gz"),
Expand All @@ -123,7 +123,7 @@ mod tests {
cpu: Cpu::Intel64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![
Method::DownloadArchive {
url: S("https://github.com/rhysd/actionlint/releases/download/v1.6.26/actionlint_1.6.26_windows_amd64.zip"),
Expand Down
12 changes: 6 additions & 6 deletions src/applications/alphavet.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::{AnalyzeResult, AppDefinition};
use crate::configuration::Version;
use crate::executables::{Executable, RunMethod};
use crate::hosting::github_releases;
use crate::installation::Method;
use crate::platform::Platform;
use crate::prelude::*;
use crate::executables::Executable;
use crate::{executables, Log};
use crate::Log;
use const_format::formatcp;

pub(crate) struct Alphavet {}
Expand All @@ -22,8 +22,8 @@ impl AppDefinition for Alphavet {
formatcp!("https://github.com/{ORG}/{REPO}")
}

fn run_method(&self, version: &Version, _platform: Platform) -> executables::Method {
executables::Method::ThisApp {
fn run_method(&self, version: &Version, _platform: Platform) -> RunMethod {
RunMethod::ThisApp {
install_methods: vec![Method::CompileGoSource {
import_path: format!("github.com/{ORG}/{REPO}/cmd/alphavet@v{version}"),
}],
Expand Down Expand Up @@ -54,7 +54,7 @@ impl AppDefinition for Alphavet {

#[cfg(test)]
mod tests {
use crate::executables;
use crate::executables::RunMethod;

#[test]
fn install_methods() {
Expand All @@ -72,7 +72,7 @@ mod tests {
cpu: Cpu::Arm64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![Method::CompileGoSource {
import_path: S("github.com/skx/alphavet/cmd/alphavet@v0.1.0"),
}],
Expand Down
12 changes: 6 additions & 6 deletions src/applications/deadcode.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::{AnalyzeResult, AppDefinition};
use crate::configuration::Version;
use crate::executables::{Executable, RunMethod};
use crate::installation::Method;
use crate::platform::Platform;
use crate::prelude::*;
use crate::executables::Executable;
use crate::{executables, Log};
use crate::Log;

pub(crate) struct Deadcode {}

Expand All @@ -17,8 +17,8 @@ impl AppDefinition for Deadcode {
"https://pkg.go.dev/golang.org/x/tools/cmd/deadcode"
}

fn run_method(&self, version: &Version, _platform: Platform) -> executables::Method {
executables::Method::ThisApp {
fn run_method(&self, version: &Version, _platform: Platform) -> RunMethod {
RunMethod::ThisApp {
install_methods: vec![Method::CompileGoSource {
import_path: format!("golang.org/x/tools/cmd/deadcode@v{version}"),
}],
Expand Down Expand Up @@ -51,7 +51,7 @@ impl AppDefinition for Deadcode {
#[cfg(test)]
mod tests {
use crate::applications::deadcode::Deadcode;
use crate::executables;
use crate::executables::RunMethod;

#[test]
fn install_methods() {
Expand All @@ -68,7 +68,7 @@ mod tests {
cpu: Cpu::Arm64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![Method::CompileGoSource {
import_path: S("golang.org/x/tools/cmd/deadcode@v0.16.1"),
}],
Expand Down
14 changes: 7 additions & 7 deletions src/applications/depth.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::{AnalyzeResult, AppDefinition};
use crate::configuration::Version;
use crate::executables::{Executable, RunMethod};
use crate::hosting::github_releases;
use crate::installation::Method;
use crate::platform::{Cpu, Os, Platform};
use crate::prelude::*;
use crate::executables::Executable;
use crate::{executables, Log};
use crate::Log;
use const_format::formatcp;

pub(crate) struct Depth {}
Expand All @@ -22,7 +22,7 @@ impl AppDefinition for Depth {
formatcp!("https://github.com/{ORG}/{REPO}")
}

fn run_method(&self, version: &Version, platform: Platform) -> executables::Method {
fn run_method(&self, version: &Version, platform: Platform) -> RunMethod {
let cpu = match platform.cpu {
Cpu::Arm64 => "aarch64", // the "arm" binaries don't run on Apple Silicon
Cpu::Intel64 => "amd64",
Expand All @@ -36,7 +36,7 @@ impl AppDefinition for Depth {
Os::Windows => ".exe",
Os::Linux | Os::MacOS => "",
};
executables::Method::ThisApp {
RunMethod::ThisApp {
install_methods: vec![
Method::DownloadExecutable {
url: format!("https://github.com/{ORG}/{REPO}/releases/download/v{version}/depth_{version}_{os}_{cpu}{ext}"),
Expand Down Expand Up @@ -77,9 +77,9 @@ mod tests {
use super::super::Depth;
use crate::applications::AppDefinition;
use crate::configuration::Version;
use crate::executables::RunMethod;
use crate::installation::Method;
use crate::platform::{Cpu, Os, Platform};
use crate::executables;
use big_s::S;

#[test]
Expand All @@ -91,7 +91,7 @@ mod tests {
cpu: Cpu::Arm64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![
Method::DownloadExecutable {
url: S("https://github.com/KyleBanks/depth/releases/download/v1.2.1/depth_1.2.1_linux_aarch64"),
Expand All @@ -113,7 +113,7 @@ mod tests {
cpu: Cpu::Intel64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![
Method::DownloadExecutable {
url: S("https://github.com/KyleBanks/depth/releases/download/v1.2.1/depth_1.2.1_windows_amd64.exe"),
Expand Down
14 changes: 7 additions & 7 deletions src/applications/dprint.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::{AnalyzeResult, AppDefinition};
use crate::configuration::Version;
use crate::executables::{Executable, RunMethod};
use crate::hosting::github_releases;
use crate::installation::{BinFolder, Method};
use crate::platform::{Cpu, Os, Platform};
use crate::prelude::*;
use crate::executables::Executable;
use crate::{regexp, executables, Log};
use crate::{regexp, Log};
use big_s::S;

pub(crate) struct Dprint {}
Expand All @@ -22,7 +22,7 @@ impl AppDefinition for Dprint {
"https://dprint.dev"
}

fn run_method(&self, version: &Version, platform: Platform) -> executables::Method {
fn run_method(&self, version: &Version, platform: Platform) -> RunMethod {
let cpu = match platform.cpu {
Cpu::Arm64 => "aarch64",
Cpu::Intel64 => "x86_64",
Expand All @@ -32,7 +32,7 @@ impl AppDefinition for Dprint {
Os::MacOS => "apple-darwin",
Os::Windows => "pc-windows-msvc",
};
executables::Method::ThisApp {
RunMethod::ThisApp {
install_methods: vec![
Method::DownloadArchive {
url: format!("https://github.com/{ORG}/{REPO}/releases/download/{version}/dprint-{cpu}-{os}.zip"),
Expand Down Expand Up @@ -81,9 +81,9 @@ mod tests {
use super::super::Dprint;
use crate::applications::AppDefinition;
use crate::configuration::Version;
use crate::executables::RunMethod;
use crate::installation::{BinFolder, Method};
use crate::platform::{Cpu, Os, Platform};
use crate::executables;
use big_s::S;

#[test]
Expand All @@ -95,7 +95,7 @@ mod tests {
cpu: Cpu::Arm64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![
Method::DownloadArchive {
url: S("https://github.com/dprint/dprint/releases/download/0.48.0/dprint-aarch64-apple-darwin.zip"),
Expand All @@ -119,7 +119,7 @@ mod tests {
cpu: Cpu::Arm64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![
Method::DownloadArchive {
url: S("https://github.com/dprint/dprint/releases/download/0.48.0/dprint-aarch64-unknown-linux-gnu.zip"),
Expand Down
12 changes: 6 additions & 6 deletions src/applications/exhaustruct.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::{AnalyzeResult, AppDefinition};
use crate::configuration::Version;
use crate::executables::{Executable, RunMethod};
use crate::hosting::github_releases;
use crate::installation::Method;
use crate::platform::Platform;
use crate::prelude::*;
use crate::executables::Executable;
use crate::{executables, Log};
use crate::Log;
use const_format::formatcp;

pub(crate) struct Exhaustruct {}
Expand All @@ -26,8 +26,8 @@ impl AppDefinition for Exhaustruct {
github_releases::latest(ORG, REPO, log)
}

fn run_method(&self, version: &Version, _platform: Platform) -> executables::Method {
executables::Method::ThisApp {
fn run_method(&self, version: &Version, _platform: Platform) -> RunMethod {
RunMethod::ThisApp {
install_methods: vec![Method::CompileGoSource {
import_path: format!("github.com/{ORG}/{REPO}/v3/cmd/exhaustruct@v{version}"),
}],
Expand All @@ -54,7 +54,7 @@ impl AppDefinition for Exhaustruct {
#[cfg(test)]
mod tests {
use crate::applications::exhaustruct::Exhaustruct;
use crate::executables;
use crate::executables::RunMethod;

#[test]
fn install_methods() {
Expand All @@ -71,7 +71,7 @@ mod tests {
cpu: Cpu::Arm64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![Method::CompileGoSource {
import_path: S("github.com/GaijinEntertainment/go-exhaustruct/v3/cmd/exhaustruct@v3.3.0"),
}],
Expand Down
15 changes: 8 additions & 7 deletions src/applications/gh.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::{AnalyzeResult, AppDefinition};
use crate::configuration::Version;
use crate::executables::{Executable, RunMethod};
use crate::hosting::github_releases;
use crate::installation::{BinFolder, Method};
use crate::platform::{Cpu, Os, Platform};
use crate::prelude::*;
use crate::executables::Executable;
use crate::{regexp, executables, Log};
use crate::{regexp, Log};
use big_s::S;
use std::path;

Expand All @@ -23,7 +23,7 @@ impl AppDefinition for Gh {
"https://cli.github.com"
}

fn run_method(&self, version: &Version, platform: Platform) -> executables::Method {
fn run_method(&self, version: &Version, platform: Platform) -> RunMethod {
let os = match platform.os {
Os::Linux => "linux",
Os::MacOS => "macOS",
Expand All @@ -38,7 +38,7 @@ impl AppDefinition for Gh {
Os::Windows | Os::MacOS => "zip",
};
let sep = path::MAIN_SEPARATOR;
executables::Method::ThisApp {
RunMethod::ThisApp {
install_methods: vec![Method::DownloadArchive {
url: format!("https://github.com/{ORG}/{REPO}/releases/download/v{version}/gh_{version}_{os}_{cpu}.{ext}"),
bin_folder: BinFolder::Subfolders {
Expand Down Expand Up @@ -86,20 +86,21 @@ mod tests {
use crate::configuration::Version;
use crate::installation::{BinFolder, Method};
use crate::platform::{Cpu, Os, Platform};
use crate::executables;
use big_s::S;

#[test]
#[cfg(unix)]
fn linux_arm() {
use crate::executables::RunMethod;

let have = (Gh {}).run_method(
&Version::from("2.39.1"),
Platform {
os: Os::Linux,
cpu: Cpu::Arm64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![Method::DownloadArchive {
url: S("https://github.com/cli/cli/releases/download/v2.39.1/gh_2.39.1_linux_arm64.tar.gz"),
bin_folder: BinFolder::Subfolders {
Expand All @@ -120,7 +121,7 @@ mod tests {
cpu: Cpu::Intel64,
},
);
let want = executables::Method::ThisApp {
let want = RunMethod::ThisApp {
install_methods: vec![Method::DownloadArchive {
url: S("https://github.com/cli/cli/releases/download/v2.39.1/gh_2.39.1_windows_amd64.zip"),
bin_folder: BinFolder::Subfolders {
Expand Down
Loading

0 comments on commit f414d45

Please # to comment.