mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 22:11:38 +00:00
Refactor path ignore rule handling in Project and ServeSession
- Introduced a new method `path_ignore_rules` in the Project struct to streamline the creation of PathIgnoreRule instances. - Updated ServeSession and snapshot middleware to utilize the new method, improving code clarity and reducing duplication. - Removed redundant PathIgnoreRule mapping from multiple locations, enhancing maintainability.
This commit is contained in:
parent
89869f685d
commit
0243181731
3 changed files with 21 additions and 23 deletions
|
|
@ -12,7 +12,11 @@ use serde::{Deserialize, Serialize};
|
|||
use thiserror::Error;
|
||||
|
||||
use crate::{
|
||||
glob::Glob, json, resolution::UnresolvedValue, snapshot::SyncRule, syncback::SyncbackRules,
|
||||
glob::Glob,
|
||||
json,
|
||||
resolution::UnresolvedValue,
|
||||
snapshot::{PathIgnoreRule, SyncRule},
|
||||
syncback::SyncbackRules,
|
||||
};
|
||||
|
||||
/// Represents 'default' project names that act as `init` files
|
||||
|
|
@ -334,6 +338,17 @@ impl Project {
|
|||
pub fn folder_location(&self) -> &Path {
|
||||
self.file_location.parent().unwrap()
|
||||
}
|
||||
|
||||
pub fn path_ignore_rules(&self) -> Vec<PathIgnoreRule> {
|
||||
let base = self.folder_location().to_path_buf();
|
||||
self.glob_ignore_paths
|
||||
.iter()
|
||||
.map(|glob| PathIgnoreRule {
|
||||
glob: glob.clone(),
|
||||
base_path: base.clone(),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue