aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/installer/noop_installer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/installer/noop_installer.rs')
-rw-r--r--crates/shirabe/src/installer/noop_installer.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/crates/shirabe/src/installer/noop_installer.rs b/crates/shirabe/src/installer/noop_installer.rs
index 8297165..12e7e95 100644
--- a/crates/shirabe/src/installer/noop_installer.rs
+++ b/crates/shirabe/src/installer/noop_installer.rs
@@ -2,6 +2,7 @@
use crate::installer::InstallerInterface;
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
@@ -51,10 +52,10 @@ impl InstallerInterface for NoopInstaller {
async fn install(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
- if !repo.has_package(package) {
- repo.add_package(package.clone_package_box());
+ if !repo.has_package(package.as_rc().borrow().as_package_interface()) {
+ repo.add_package(package.clone());
}
Ok(None)
@@ -63,10 +64,10 @@ impl InstallerInterface for NoopInstaller {
async fn update(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- initial: &dyn PackageInterface,
- target: &dyn PackageInterface,
+ initial: &PackageInterfaceHandle,
+ target: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
- if !repo.has_package(initial) {
+ if !repo.has_package(initial.as_rc().borrow().as_package_interface()) {
return Err(InvalidArgumentException {
message: format!("Package is not installed: {}", initial),
code: 0,
@@ -74,9 +75,9 @@ impl InstallerInterface for NoopInstaller {
.into());
}
- repo.remove_package(initial);
- if !repo.has_package(target) {
- repo.add_package(target.clone_package_box());
+ repo.remove_package(initial.as_rc().borrow().as_package_interface());
+ if !repo.has_package(target.as_rc().borrow().as_package_interface()) {
+ repo.add_package(target.clone());
}
Ok(None)
@@ -85,16 +86,16 @@ impl InstallerInterface for NoopInstaller {
async fn uninstall(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
- if !repo.has_package(package) {
+ if !repo.has_package(package.as_rc().borrow().as_package_interface()) {
return Err(InvalidArgumentException {
message: format!("Package is not installed: {}", package),
code: 0,
}
.into());
}
- repo.remove_package(package);
+ repo.remove_package(package.as_rc().borrow().as_package_interface());
Ok(None)
}