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
132
133
134
135
136
137
138
139
|
//! ref: composer/src/Composer/Repository/InstalledArrayRepository.php
use indexmap::IndexMap;
use shirabe_php_shim::Countable;
use shirabe_semver::constraint::ConstraintInterface;
use crate::package::BasePackage;
use crate::package::PackageInterface;
use crate::repository::AdvisoryProviderInterface;
use crate::repository::InstalledRepositoryInterface;
use crate::repository::WritableArrayRepository;
use crate::repository::WritableRepositoryInterface;
use crate::repository::{
FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface, SearchResult,
};
#[derive(Debug)]
pub struct InstalledArrayRepository {
inner: WritableArrayRepository,
}
impl InstalledArrayRepository {
pub fn new() -> anyhow::Result<Self> {
Self::new_with_packages(Vec::new())
}
pub fn new_with_packages(packages: Vec<Box<dyn PackageInterface>>) -> anyhow::Result<Self> {
Ok(Self {
inner: WritableArrayRepository::new(packages)?,
})
}
pub fn get_repo_name(&self) -> String {
format!("installed {}", self.inner.get_repo_name())
}
}
impl InstalledRepositoryInterface for InstalledArrayRepository {
fn get_dev_mode(&self) -> Option<bool> {
self.inner.get_dev_mode()
}
fn is_fresh(&self) -> bool {
self.inner.count() == 0
}
}
impl WritableRepositoryInterface for InstalledArrayRepository {
fn write(
&mut self,
dev_mode: bool,
installation_manager: &crate::installer::InstallationManager,
) -> anyhow::Result<()> {
todo!()
}
fn add_package(
&mut self,
package: Box<dyn crate::package::PackageInterface>,
) -> anyhow::Result<()> {
todo!()
}
fn remove_package(
&mut self,
package: &dyn crate::package::PackageInterface,
) -> anyhow::Result<()> {
todo!()
}
fn get_canonical_packages(&self) -> Vec<Box<dyn crate::package::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 InstalledArrayRepository {
fn count(&self) -> i64 {
todo!()
}
}
impl RepositoryInterface for InstalledArrayRepository {
fn has_package(&self, _package: &dyn PackageInterface) -> bool {
todo!()
}
fn find_package(
&self,
_name: &str,
_constraint: FindPackageConstraint,
) -> Option<Box<dyn BasePackage>> {
todo!()
}
fn find_packages(
&self,
_name: &str,
_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!()
}
}
|