Skip to content

Commit

Permalink
Fix legacy manifests being prioritized over rokit
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptibell committed Mar 29, 2024
1 parent 6baeefb commit 074122a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/discovery/aftman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl Manifest for AftmanManifest {
"aftman.toml"
}

fn load_manifest(contents: &str) -> Option<Self>
fn parse_manifest(contents: &str) -> Option<Self>
where
Self: Sized,
{
Expand Down
2 changes: 1 addition & 1 deletion lib/discovery/foreman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Manifest for ForemanManifest {
"foreman.toml"
}

fn load_manifest(contents: &str) -> Option<Self>
fn parse_manifest(contents: &str) -> Option<Self>
where
Self: Sized,
{
Expand Down
16 changes: 7 additions & 9 deletions lib/discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
{
fn home_dir() -> &'static str;
fn manifest_file_name() -> &'static str;
fn load_manifest(contents: &str) -> Option<Self>;
fn parse_manifest(contents: &str) -> Option<Self>;
fn into_tools(self) -> HashMap<ToolAlias, ToolSpec>;
}

Expand Down Expand Up @@ -94,8 +94,6 @@ fn search_paths(cwd: &Path, rokit_only: bool, skip_home: bool) -> Vec<(ManifestK
}
}

// Reverse all our dirs so that highest priority comes first
ordered_paths.reverse();
ordered_paths
}

Expand Down Expand Up @@ -125,9 +123,9 @@ pub async fn discover_all_manifests(rokit_only: bool, skip_home: bool) -> Vec<Di
.into_iter()
.filter_map(|(kind, path, contents)| {
let tools = match kind {
ManifestKind::Rokit => RokitManifest::load_manifest(&contents)?.into_tools(),
ManifestKind::Aftman => AftmanManifest::load_manifest(&contents)?.into_tools(),
ManifestKind::Foreman => ForemanManifest::load_manifest(&contents)?.into_tools(),
ManifestKind::Rokit => RokitManifest::parse_manifest(&contents)?.into_tools(),
ManifestKind::Aftman => AftmanManifest::parse_manifest(&contents)?.into_tools(),
ManifestKind::Foreman => ForemanManifest::parse_manifest(&contents)?.into_tools(),
};
let path_depth = path.components().count();
let depth = cwd_depth - path_depth;
Expand Down Expand Up @@ -159,9 +157,9 @@ pub async fn discover_tool_spec(
};

let tools = match kind {
ManifestKind::Rokit => RokitManifest::load_manifest(&contents)?.into_tools(),
ManifestKind::Aftman => AftmanManifest::load_manifest(&contents)?.into_tools(),
ManifestKind::Foreman => ForemanManifest::load_manifest(&contents)?.into_tools(),
ManifestKind::Rokit => RokitManifest::parse_manifest(&contents)?.into_tools(),
ManifestKind::Aftman => AftmanManifest::parse_manifest(&contents)?.into_tools(),
ManifestKind::Foreman => ForemanManifest::parse_manifest(&contents)?.into_tools(),
};

if let Some(spec) = tools.get(alias) {
Expand Down
2 changes: 1 addition & 1 deletion lib/discovery/rokit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Manifest for RokitManifest {
"rokit.toml"
}

fn load_manifest(contents: &str) -> Option<Self>
fn parse_manifest(contents: &str) -> Option<Self>
where
Self: Sized,
{
Expand Down

0 comments on commit 074122a

Please sign in to comment.