Skip to content

Commit

Permalink
fix: remove keygen.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante committed Oct 21, 2024
1 parent db7a088 commit 3a9b272
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 65 deletions.
6 changes: 0 additions & 6 deletions crates/cli/src/commands/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ pub(crate) async fn run_doctor(_arg: DoctorArgs) -> Result<()> {
);
continue;
}
let manifest = existing_manifests.get(&name).unwrap();
if manifest.version.is_none() {
if let Some(supported) = SupportedApp::from_all_app(manifest.name.clone()) {
updater.sync_manifest_version(supported).await?;
}
}
}

for app_manifest in updater.binaries.values() {
Expand Down
54 changes: 0 additions & 54 deletions crates/cli/src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ async fn read_manifest(manifest_path: &PathBuf) -> Result<Manifest> {
}

const MANIFEST_FILE: &str = "manifests.json";
const KEYGEN_API: &str = "https://api.keygen.sh/";
const KEYGEN_ACCOUNT: &str = "custodian-dev";

#[derive(Debug)]
pub struct Updater {
Expand Down Expand Up @@ -538,26 +536,6 @@ impl Updater {
bail!("Attempted to install {} but could not find it", app);
}

pub async fn sync_manifest_version(&mut self, app: SupportedApp) -> Result<Option<String>> {
let app_string = app.get_base_name();
let release = match self.binaries.get(&app_string) {
Some(app_manifest) => app_manifest.release.clone(),
None => None,
};
if release.is_none() {
return Ok(None);
}
let info_url = release_details_relative_url(release.as_ref().unwrap());
let manifest = fetch_manifest(&info_url, app).await?;
if manifest.version.is_none() || manifest.release.is_none() {
return Ok(None);
}
let version = manifest.version.clone();
self.set_app_version(app, manifest.version.unwrap(), manifest.release.unwrap())?;
self.dump().await?;
Ok(version)
}

fn set_app_version(
&mut self,
app: SupportedApp,
Expand Down Expand Up @@ -625,38 +603,6 @@ async fn check_release_axo(
Ok(new_version)
}

async fn fetch_manifest(relative_url: &str, app: SupportedApp) -> Result<AppManifest> {
let client = reqwest::Client::builder().build()?;
let url = format!("{}{}", KEYGEN_API, relative_url);
let res = client.get(url).send().await?.text().await?;
let json_data: serde_json::Value = serde_json::from_str(&res).unwrap();

let version = if let Some(version) = json_data["data"]
.get("attributes")
.and_then(|attributes| attributes.get("version"))
{
version.as_str().unwrap().to_string()
} else {
bail!("Could not find version");
};

let release = if let Some(id) = json_data["data"].get("id") {
id.as_str().unwrap().to_string()
} else {
bail!("Could not find release");
};

Ok(AppManifest {
name: AllApp::from_supported_app(app),
release: Some(release),
version: Some(version),
})
}

fn release_details_relative_url(release: &str) -> String {
format!("/v1/accounts/{}/releases/{}", KEYGEN_ACCOUNT, release)
}

#[cfg(test)]
mod tests {

Expand Down
5 changes: 0 additions & 5 deletions python/gritql/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

import httpx

# handles downloading the Grit CL if not found already

KEYGEN_ACCOUNT = "custodian-dev"


def _cache_dir() -> Path:
xdg = os.environ.get("XDG_CACHE_HOME")
if xdg is not None:
Expand Down

0 comments on commit 3a9b272

Please sign in to comment.