Implement glob ignores (#272)

* Add Glob wrapper type with better serialization

* Introduce PathIgnoreRule struct

* Implement equality for Glob type

* Add PathIgnoreRule to InstanceContext

* Implement glob ignores in directory middleware

* Fix up filters

* Use Iterator::all instead of loop

* Add project-level configuration for glob ignores

* Add test project for glob ignores

* Wire up project file and snapshots to make glob ignores work

* Better codepaths for adding ignore rules with empty iterators

* Add test for globs inherited from parent projects

* Add test details, support glob ignores in nested projects

* Add feature flag for globs

* Switch to use ExactSizeIterator instead of size_hint

* Remove glob visitor
This commit is contained in:
Lucien Greathouse
2020-01-08 17:58:37 -08:00
committed by GitHub
parent ae811aafd0
commit e261e7a2c7
30 changed files with 310 additions and 11 deletions

View File

@@ -8,6 +8,8 @@ use rbx_dom_weak::UnresolvedRbxValue;
use serde::{Deserialize, Serialize};
use snafu::{ResultExt, Snafu};
use crate::glob::Glob;
static PROJECT_FILENAME: &str = "default.project.json";
/// Error type returned by any function that handles projects.
@@ -52,6 +54,12 @@ pub struct Project {
#[serde(skip_serializing_if = "Option::is_none")]
pub serve_place_ids: Option<HashSet<u64>>,
/// A list of globs, relative to the folder the project file is in, that
/// match files that should be excluded if Rojo encounters them.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
#[cfg_attr(not(feature = "unstable_glob_ignore_paths"), serde(skip))]
pub glob_ignore_paths: Vec<Glob>,
/// The path to the file that this project came from. Relative paths in the
/// project should be considered relative to the parent of this field, also
/// given by `Project::folder_location`.