mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 03:36:06 +00:00
Add InstanceMetadata builder (#269)
* Add InstanceMetadata builder, with context field for globbing * Revert snapshot changes * Port snapshot functions to InstanceMetadata builder-ish pattern * Remove IgnoreGlob struct * Elide lifetime
This commit is contained in:
parent
da6c7b4d7a
commit
a48c238ed7
8 changed files with 75 additions and 39 deletions
|
|
@ -47,11 +47,11 @@ impl SnapshotMiddleware for SnapshotCsv {
|
|||
value: table_contents,
|
||||
},
|
||||
})
|
||||
.metadata(InstanceMetadata {
|
||||
instigating_source: Some(entry.path().to_path_buf().into()),
|
||||
relevant_paths: vec![entry.path().to_path_buf(), meta_path.clone()],
|
||||
..Default::default()
|
||||
});
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
.instigating_source(entry.path())
|
||||
.relevant_paths(vec![entry.path().to_path_buf(), meta_path.clone()]),
|
||||
);
|
||||
|
||||
if let Some(meta_entry) = vfs.get(meta_path).with_not_found()? {
|
||||
let meta_contents = meta_entry.contents(vfs)?;
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@ impl SnapshotMiddleware for SnapshotDir {
|
|||
.name(instance_name)
|
||||
.class_name("Folder")
|
||||
.children(snapshot_children)
|
||||
.metadata(InstanceMetadata {
|
||||
instigating_source: Some(entry.path().to_path_buf().into()),
|
||||
relevant_paths,
|
||||
..Default::default()
|
||||
});
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
.instigating_source(entry.path())
|
||||
.relevant_paths(relevant_paths),
|
||||
);
|
||||
|
||||
if let Some(meta_entry) = vfs.get(meta_path).with_not_found()? {
|
||||
let meta_contents = meta_entry.contents(vfs)?;
|
||||
|
|
|
|||
|
|
@ -87,11 +87,11 @@ fn snapshot_lua_file<F: VfsFetcher>(vfs: &Vfs<F>, entry: &VfsEntry) -> SnapshotI
|
|||
value: contents_str,
|
||||
},
|
||||
})
|
||||
.metadata(InstanceMetadata {
|
||||
instigating_source: Some(entry.path().to_path_buf().into()),
|
||||
relevant_paths: vec![entry.path().to_path_buf(), meta_path.clone()],
|
||||
..Default::default()
|
||||
});
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
.instigating_source(entry.path())
|
||||
.relevant_paths(vec![entry.path().to_path_buf(), meta_path.clone()]),
|
||||
);
|
||||
|
||||
if let Some(meta_entry) = vfs.get(meta_path).with_not_found()? {
|
||||
let meta_contents = meta_entry.contents(vfs)?;
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ impl SnapshotMiddleware for SnapshotRbxlx {
|
|||
|
||||
let snapshot = InstanceSnapshot::from_tree(&temp_tree, root_id)
|
||||
.name(instance_name)
|
||||
.metadata(InstanceMetadata {
|
||||
instigating_source: Some(entry.path().to_path_buf().into()),
|
||||
relevant_paths: vec![entry.path().to_path_buf()],
|
||||
..Default::default()
|
||||
});
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
.instigating_source(entry.path())
|
||||
.relevant_paths(vec![entry.path().to_path_buf()]),
|
||||
);
|
||||
|
||||
Ok(Some(snapshot))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ impl SnapshotMiddleware for SnapshotRbxm {
|
|||
if children.len() == 1 {
|
||||
let snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0])
|
||||
.name(instance_name)
|
||||
.metadata(InstanceMetadata {
|
||||
instigating_source: Some(entry.path().to_path_buf().into()),
|
||||
relevant_paths: vec![entry.path().to_path_buf()],
|
||||
..Default::default()
|
||||
});
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
.instigating_source(entry.path())
|
||||
.relevant_paths(vec![entry.path().to_path_buf()]),
|
||||
);
|
||||
|
||||
Ok(Some(snapshot))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ impl SnapshotMiddleware for SnapshotRbxmx {
|
|||
if children.len() == 1 {
|
||||
let snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0])
|
||||
.name(instance_name)
|
||||
.metadata(InstanceMetadata {
|
||||
instigating_source: Some(entry.path().to_path_buf().into()),
|
||||
relevant_paths: vec![entry.path().to_path_buf()],
|
||||
..Default::default()
|
||||
});
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
.instigating_source(entry.path())
|
||||
.relevant_paths(vec![entry.path().to_path_buf()]),
|
||||
);
|
||||
|
||||
Ok(Some(snapshot))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ impl SnapshotMiddleware for SnapshotTxt {
|
|||
.name(instance_name)
|
||||
.class_name("StringValue")
|
||||
.properties(properties)
|
||||
.metadata(InstanceMetadata {
|
||||
instigating_source: Some(entry.path().to_path_buf().into()),
|
||||
relevant_paths: vec![entry.path().to_path_buf(), meta_path.clone()],
|
||||
..Default::default()
|
||||
});
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
.instigating_source(entry.path())
|
||||
.relevant_paths(vec![entry.path().to_path_buf(), meta_path.clone()]),
|
||||
);
|
||||
|
||||
if let Some(meta_entry) = vfs.get(meta_path).with_not_found()? {
|
||||
let meta_contents = meta_entry.contents(vfs)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue