mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 21:41:37 +00:00
Refactor script class handling and improve imports in git.rs and ref_properties.rs
- Moved the `is_script_class` function to the `snapshot` module for better organization and reusability. - Updated imports in `git.rs` and `ref_properties.rs` to reflect the new location of `is_script_class`, enhancing code clarity and maintainability. These changes aim to streamline script class management and improve the overall structure of the codebase.
This commit is contained in:
parent
a68e0ab7c6
commit
d4b390a3ec
2 changed files with 5 additions and 11 deletions
11
src/git.rs
11
src/git.rs
|
|
@ -10,13 +10,10 @@ use std::{
|
||||||
use rbx_dom_weak::types::Ref;
|
use rbx_dom_weak::types::Ref;
|
||||||
use sha1::{Digest, Sha1};
|
use sha1::{Digest, Sha1};
|
||||||
|
|
||||||
use crate::{snapshot::RojoTree, web::interface::GitMetadata};
|
use crate::{
|
||||||
|
snapshot::{is_script_class, RojoTree},
|
||||||
const SCRIPT_CLASSES: &[&str] = &["Script", "LocalScript", "ModuleScript"];
|
web::interface::GitMetadata,
|
||||||
|
};
|
||||||
fn is_script_class(class: &str) -> bool {
|
|
||||||
SCRIPT_CLASSES.contains(&class)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn git_repo_root(project_root: &Path) -> Option<PathBuf> {
|
pub fn git_repo_root(project_root: &Path) -> Option<PathBuf> {
|
||||||
let output = Command::new("git")
|
let output = Command::new("git")
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ use rbx_dom_weak::{
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ref_attribute_name, ref_target_attribute_name,
|
ref_attribute_name, ref_target_attribute_name,
|
||||||
|
snapshot::is_script_class,
|
||||||
syncback::{name_needs_slugify, slugify_name},
|
syncback::{name_needs_slugify, slugify_name},
|
||||||
REF_ID_ATTRIBUTE_NAME, REF_PATH_ATTRIBUTE_PREFIX, REF_POINTER_ATTRIBUTE_PREFIX,
|
REF_ID_ATTRIBUTE_NAME, REF_PATH_ATTRIBUTE_PREFIX, REF_POINTER_ATTRIBUTE_PREFIX,
|
||||||
};
|
};
|
||||||
|
|
@ -131,10 +132,6 @@ fn tentative_fs_name(inst: &Instance) -> String {
|
||||||
format!("{slug}.{extension}")
|
format!("{slug}.{extension}")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_script_class(class: &str) -> bool {
|
|
||||||
matches!(class, "Script" | "LocalScript" | "ModuleScript")
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct RefLinks {
|
pub struct RefLinks {
|
||||||
/// Refs that use path-based linking (path is unique).
|
/// Refs that use path-based linking (path is unique).
|
||||||
path_links: HashMap<Ref, Vec<PathRefLink>>,
|
path_links: HashMap<Ref, Vec<PathRefLink>>,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue