aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/repository_manager.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/repository/repository_manager.rs')
-rw-r--r--crates/shirabe/src/repository/repository_manager.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/shirabe/src/repository/repository_manager.rs b/crates/shirabe/src/repository/repository_manager.rs
index f432d6e..72c3643 100644
--- a/crates/shirabe/src/repository/repository_manager.rs
+++ b/crates/shirabe/src/repository/repository_manager.rs
@@ -7,6 +7,7 @@ use shirabe_semver::constraint::AnyConstraint;
use crate::config::Config;
use crate::event_dispatcher::EventDispatcher;
use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::package::PackageInterfaceHandle;
use crate::repository::FilterRepository;
use crate::repository::InstalledRepositoryInterface;
@@ -19,7 +20,7 @@ pub struct RepositoryManager {
local_repository: Option<Box<dyn InstalledRepositoryInterface>>,
repositories: Vec<Box<dyn RepositoryInterface>>,
repository_classes: IndexMap<String, String>,
- io: Box<dyn IOInterface>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
@@ -28,19 +29,22 @@ pub struct RepositoryManager {
impl RepositoryManager {
pub fn new(
- io: &dyn IOInterface,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
config: std::rc::Rc<std::cell::RefCell<Config>>,
http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
process: Option<std::rc::Rc<std::cell::RefCell<ProcessExecutor>>>,
) -> Self {
- let process = process
- .unwrap_or_else(|| std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(io))));
+ let process = process.unwrap_or_else(|| {
+ std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))))
+ });
Self {
local_repository: None,
repositories: vec![],
repository_classes: IndexMap::new(),
- io: io.clone_box(),
+ io,
config,
http_downloader,
event_dispatcher,