aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/installed_filesystem_repository.rs
blob: ff28f6e21e55f478f8fe3c35695c831ef1709656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! ref: composer/src/Composer/Repository/InstalledFilesystemRepository.php

use indexmap::IndexMap;
use shirabe_php_shim::Countable;
use shirabe_semver::constraint::constraint_interface::ConstraintInterface;

use crate::package::base_package::BasePackage;
use crate::package::package_interface::PackageInterface;
use crate::repository::advisory_provider_interface::AdvisoryProviderInterface;
use crate::repository::filesystem_repository::FilesystemRepository;
use crate::repository::installed_repository_interface::InstalledRepositoryInterface;
use crate::repository::repository_interface::{
    FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface, SearchResult,
};
use crate::repository::writable_repository_interface::WritableRepositoryInterface;

#[derive(Debug)]
pub struct InstalledFilesystemRepository {
    inner: FilesystemRepository,
}

impl InstalledFilesystemRepository {
    pub fn get_repo_name(&self) -> String {
        format!("installed {}", self.inner.get_repo_name())
    }
}

impl InstalledRepositoryInterface for InstalledFilesystemRepository {
    fn get_dev_mode(&self) -> Option<bool> {
        self.inner.get_dev_mode()
    }

    fn is_fresh(&self) -> bool {
        !self.inner.file.exists()
    }
}

impl WritableRepositoryInterface for InstalledFilesystemRepository {
    fn write(
        &mut self,
        dev_mode: bool,
        installation_manager: &crate::installer::installation_manager::InstallationManager,
    ) -> anyhow::Result<()> {
        todo!()
    }

    fn add_package(
        &mut self,
        package: Box<dyn crate::package::package_interface::PackageInterface>,
    ) -> anyhow::Result<()> {
        todo!()
    }

    fn remove_package(
        &mut self,
        package: &dyn crate::package::package_interface::PackageInterface,
    ) -> anyhow::Result<()> {
        todo!()
    }

    fn get_canonical_packages(
        &self,
    ) -> Vec<Box<dyn crate::package::package_interface::PackageInterface>> {
        todo!()
    }

    fn reload(&mut self) {
        todo!()
    }

    fn set_dev_package_names(&mut self, dev_package_names: Vec<String>) {
        todo!()
    }

    fn get_dev_package_names(&self) -> &Vec<String> {
        todo!()
    }
}

impl Countable for InstalledFilesystemRepository {
    fn count(&self) -> i64 {
        todo!()
    }
}

impl RepositoryInterface for InstalledFilesystemRepository {
    fn has_package(&self, _package: &dyn PackageInterface) -> bool {
        todo!()
    }
    fn find_package(
        &self,
        _name: String,
        _constraint: FindPackageConstraint,
    ) -> Option<Box<dyn BasePackage>> {
        todo!()
    }
    fn find_packages(
        &self,
        _name: String,
        _constraint: Option<FindPackageConstraint>,
    ) -> Vec<Box<dyn BasePackage>> {
        todo!()
    }
    fn get_packages(&self) -> Vec<Box<dyn BasePackage>> {
        todo!()
    }
    fn load_packages(
        &self,
        _package_name_map: IndexMap<String, Option<Box<dyn ConstraintInterface>>>,
        _acceptable_stabilities: IndexMap<String, i64>,
        _stability_flags: IndexMap<String, i64>,
        _already_loaded: IndexMap<String, IndexMap<String, Box<dyn PackageInterface>>>,
    ) -> LoadPackagesResult {
        todo!()
    }
    fn search(&self, _query: String, _mode: i64, _type: Option<String>) -> Vec<SearchResult> {
        todo!()
    }
    fn get_providers(&self, _package_name: String) -> IndexMap<String, ProviderInfo> {
        todo!()
    }
    fn get_repo_name(&self) -> String {
        todo!()
    }
    fn as_advisory_provider(&self) -> Option<&dyn AdvisoryProviderInterface> {
        None
    }
    fn as_any(&self) -> &dyn std::any::Any {
        todo!()
    }
}