diff --git a/lib/src/metta/runner/builtin_mods/catalog_mods.rs b/lib/src/metta/runner/builtin_mods/catalog_mods.rs index 24f64d175..140859fbd 100644 --- a/lib/src/metta/runner/builtin_mods/catalog_mods.rs +++ b/lib/src/metta/runner/builtin_mods/catalog_mods.rs @@ -125,9 +125,9 @@ impl Grounded for CatalogListOp { } let mut found_one = false; - if cat_name == "all" || cat_name == "git-modules" { - if let Some(explicit_git_catalog) = &self.metta.environment().explicit_git_mods { - list_catalog(explicit_git_catalog); + if cat_name == "all" || cat_name == "specified-mods" { + if let Some(specified_mods) = &self.metta.environment().specified_mods { + list_catalog(specified_mods); found_one = true; } } @@ -187,9 +187,9 @@ impl Grounded for CatalogUpdateOp { }; let mut found_one = false; - if cat_name == "all" || cat_name == "git-modules" { - if let Some(explicit_git_catalog) = &self.metta.environment().explicit_git_mods { - explicit_git_catalog.fetch_newest_for_all(UpdateMode::FetchLatest)?; + if cat_name == "all" || cat_name == "specified-mods" { + if let Some(specified_mods) = &self.metta.environment().specified_mods { + specified_mods.fetch_newest_for_all(UpdateMode::FetchLatest)?; found_one = true; } } @@ -253,9 +253,9 @@ impl Grounded for CatalogClearOp { }; let mut found_one = false; - if cat_name == "all" || cat_name == "git-modules" { - if let Some(explicit_git_catalog) = &self.metta.environment().explicit_git_mods { - explicit_git_catalog.clear_all()?; + if cat_name == "all" || cat_name == "specified-mods" { + if let Some(specified_mods) = &self.metta.environment().specified_mods { + specified_mods.clear_all()?; found_one = true; } } diff --git a/lib/src/metta/runner/environment.rs b/lib/src/metta/runner/environment.rs index 42c2a9252..b276fe46e 100644 --- a/lib/src/metta/runner/environment.rs +++ b/lib/src/metta/runner/environment.rs @@ -26,9 +26,9 @@ pub struct Environment { catalogs: Vec>, #[cfg(feature = "pkg_mgmt")] pub(crate) fs_mod_formats: Arc>>, - /// The store for modules loaded from git by explicit URL + /// The store for modules cached locally after loading from a specific location, for example, via git. #[cfg(feature = "pkg_mgmt")] - pub(crate) explicit_git_mods: Option, + pub(crate) specified_mods: Option, } const DEFAULT_INIT_METTA: &[u8] = include_bytes!("init.default.metta"); @@ -99,7 +99,7 @@ impl Environment { #[cfg(feature = "pkg_mgmt")] fs_mod_formats: Arc::new(vec![]), #[cfg(feature = "pkg_mgmt")] - explicit_git_mods: None, + specified_mods: None, } } } @@ -362,11 +362,11 @@ impl EnvBuilder { //If we have a caches dir to cache modules locally then register remote catalogs if let Some(caches_dir) = &env.caches_dir { - //Setup the explicit_git_mods managed catalog to hold mods fetched by explicit URL - let mut explicit_git_mods = LocalCatalog::new(caches_dir, "git-modules").unwrap(); - let git_mod_catalog = GitCatalog::new_without_source_repo(caches_dir, env.fs_mod_formats.clone(), "git-modules").unwrap(); - explicit_git_mods.push_upstream_catalog(Box::new(git_mod_catalog)); - env.explicit_git_mods = Some(explicit_git_mods); + //Setup the specified_mods managed catalog to hold mods fetched by explicit means + let mut specified_mods = LocalCatalog::new(caches_dir, "specified-mods").unwrap(); + let git_mod_catalog = GitCatalog::new_without_source_repo(caches_dir, env.fs_mod_formats.clone(), "specified-mods").unwrap(); + specified_mods.push_upstream_catalog(Box::new(git_mod_catalog)); + env.specified_mods = Some(specified_mods); } } diff --git a/lib/src/metta/runner/pkg_mgmt/catalog.rs b/lib/src/metta/runner/pkg_mgmt/catalog.rs index 716fb10bb..818cd4644 100644 --- a/lib/src/metta/runner/pkg_mgmt/catalog.rs +++ b/lib/src/metta/runner/pkg_mgmt/catalog.rs @@ -329,8 +329,8 @@ pub(crate) fn resolve_module(pkg_info: Option<&PkgInfo>, context: &RunContext, n //Get the module if it's specified with git keys if entry.git_location.get_url().is_some() { - match context.metta.environment().explicit_git_mods.as_ref() { - Some(explicit_git_catalog) => if let Some(pair) = explicit_git_catalog.loader_for_explicit_git_module(mod_name, UpdateMode::FetchIfMissing, &entry.git_location)? { + match context.metta.environment().specified_mods.as_ref() { + Some(specified_mods) => if let Some(pair) = specified_mods.loader_for_explicit_git_module(mod_name, UpdateMode::FetchIfMissing, &entry.git_location)? { return Ok(Some(pair)); }, None => return Err(format!("Unable to pull module \"{mod_name}\" from git; no local \"caches\" directory available")) diff --git a/lib/src/metta/runner/pkg_mgmt/managed_catalog.rs b/lib/src/metta/runner/pkg_mgmt/managed_catalog.rs index 624d68192..406c435b4 100644 --- a/lib/src/metta/runner/pkg_mgmt/managed_catalog.rs +++ b/lib/src/metta/runner/pkg_mgmt/managed_catalog.rs @@ -7,8 +7,8 @@ use git_catalog::{GitCatalog, ModuleGitLocation}; use crate::metta::runner::*; use crate::metta::runner::pkg_mgmt::*; -/// An interface to facilitate explicit management of a catalog, usually as a local mirror -/// of one or more remote catalogs used by a user to insulate them from upstream changes +/// An interface to facilitate direct programatic management of a catalog, usually as a local +/// mirror of one or more remote catalogs used by a user to insulate them from upstream changes // //NOTE FOR THE FUTURE: There are two major problems with this `fetch_newest_for_all` // interface. diff --git a/lib/src/metta/runner/stdlib.rs b/lib/src/metta/runner/stdlib.rs index 9886ae6d5..15036423d 100644 --- a/lib/src/metta/runner/stdlib.rs +++ b/lib/src/metta/runner/stdlib.rs @@ -1079,8 +1079,8 @@ pub(crate) mod pkg_mgmt_ops { let git_mod_location = ModuleGitLocation::new(url.to_string()); - match context.metta.environment().explicit_git_mods.as_ref() { - Some(explicit_git_catalog) => if let Some((loader, descriptor)) = explicit_git_catalog.loader_for_explicit_git_module(&mod_name, UpdateMode::TryFetchLatest, &git_mod_location)? { + match context.metta.environment().specified_mods.as_ref() { + Some(specified_mods) => if let Some((loader, descriptor)) = specified_mods.loader_for_explicit_git_module(&mod_name, UpdateMode::TryFetchLatest, &git_mod_location)? { context.get_or_init_module_with_descriptor(&mod_name, descriptor, loader).map_err(|e| ExecError::from(e))?; }, None => return Err(ExecError::from(format!("Unable to pull module \"{mod_name}\" from git; no local \"caches\" directory available")))