mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
fix skeleton
This commit is contained in:
parent
4f1f85db91
commit
a77b5c08e9
1 changed files with 15 additions and 2 deletions
|
|
@ -11,6 +11,7 @@ pub struct Mapping<'a> {
|
||||||
mapping_type: MappingType,
|
mapping_type: MappingType,
|
||||||
read_only: bool,
|
read_only: bool,
|
||||||
map: bool,
|
map: bool,
|
||||||
|
create: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Mapping<'a> {
|
impl<'a> Mapping<'a> {
|
||||||
|
|
@ -30,6 +31,7 @@ impl<'a> Mapping<'a> {
|
||||||
mapping_type: MappingType::Folder,
|
mapping_type: MappingType::Folder,
|
||||||
read_only: false,
|
read_only: false,
|
||||||
map: true,
|
map: true,
|
||||||
|
create: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,6 +46,13 @@ impl<'a> Mapping<'a> {
|
||||||
Self { map: false, ..self }
|
Self { map: false, ..self }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn dont_create(self) -> Self {
|
||||||
|
Self {
|
||||||
|
create: false,
|
||||||
|
..self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn file(self) -> Self {
|
pub fn file(self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
mapping_type: MappingType::File,
|
mapping_type: MappingType::File,
|
||||||
|
|
@ -52,6 +61,9 @@ impl<'a> Mapping<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create(&self, id: &str, config: &HazeConfig) -> Result<()> {
|
pub async fn create(&self, id: &str, config: &HazeConfig) -> Result<()> {
|
||||||
|
if !self.create {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let source = match self.source_type {
|
let source = match self.source_type {
|
||||||
MappingSourceType::WorkDir => config.work_dir.join(id).join(self.source),
|
MappingSourceType::WorkDir => config.work_dir.join(id).join(self.source),
|
||||||
MappingSourceType::GlobalWorkDir => config.work_dir.join(self.source),
|
MappingSourceType::GlobalWorkDir => config.work_dir.join(self.source),
|
||||||
|
|
@ -93,11 +105,12 @@ pub fn default_mappings() -> Vec<Mapping<'static>> {
|
||||||
Mapping::new(WorkDir, "skeleton", "/var/www/html/core/skeleton"),
|
Mapping::new(WorkDir, "skeleton", "/var/www/html/core/skeleton"),
|
||||||
Mapping::new(
|
Mapping::new(
|
||||||
Sources,
|
Sources,
|
||||||
"skeleton/welcome.txt",
|
"core/skeleton/welcome.txt",
|
||||||
"/var/www/html/core/skeleton/welcome.txt",
|
"/var/www/html/core/skeleton/welcome.txt",
|
||||||
)
|
)
|
||||||
.file()
|
.file()
|
||||||
.read_only(),
|
.read_only()
|
||||||
|
.dont_create(),
|
||||||
Mapping::new(
|
Mapping::new(
|
||||||
WorkDir,
|
WorkDir,
|
||||||
"integration/vendor",
|
"integration/vendor",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue