feat: Add Rhai scripting support for SAL
- Add Rhai scripting integration to the SAL library. - Create documentation for Rhai module usage and available functions. - Implement comprehensive test suite for the Rhai integration. - Add `.gitignore` entries for test related temporary files.
This commit is contained in:
@@ -3,71 +3,95 @@
|
||||
//! This module provides integration with the Rhai scripting language,
|
||||
//! allowing SAL functions to be called from Rhai scripts.
|
||||
|
||||
mod buildah;
|
||||
mod error;
|
||||
mod git;
|
||||
mod nerdctl;
|
||||
mod os;
|
||||
mod process;
|
||||
mod buildah;
|
||||
mod nerdctl;
|
||||
mod git;
|
||||
mod text;
|
||||
mod rfs;
|
||||
mod text;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
// Re-export common Rhai types for convenience
|
||||
pub use rhai::{Array, Dynamic, Map, EvalAltResult, Engine};
|
||||
pub use rhai::{Array, Dynamic, Engine, EvalAltResult, Map};
|
||||
|
||||
// Re-export error module
|
||||
pub use error::*;
|
||||
|
||||
// Re-export specific functions from modules to avoid name conflicts
|
||||
pub use os::{
|
||||
register_os_module,
|
||||
// File system functions
|
||||
exist, find_file, find_files, find_dir, find_dirs,
|
||||
delete, mkdir, file_size, rsync,
|
||||
delete,
|
||||
// Download functions
|
||||
download, download_install
|
||||
download,
|
||||
download_install,
|
||||
// File system functions
|
||||
exist,
|
||||
file_size,
|
||||
find_dir,
|
||||
find_dirs,
|
||||
find_file,
|
||||
find_files,
|
||||
mkdir,
|
||||
register_os_module,
|
||||
rsync,
|
||||
};
|
||||
|
||||
pub use process::{
|
||||
kill,
|
||||
process_get,
|
||||
process_list,
|
||||
register_process_module,
|
||||
// Run functions
|
||||
// Process management functions
|
||||
which, kill, process_list, process_get
|
||||
which,
|
||||
};
|
||||
|
||||
// Re-export buildah functions
|
||||
pub use buildah::register_bah_module;
|
||||
pub use buildah::bah_new;
|
||||
pub use buildah::register_bah_module;
|
||||
|
||||
// Re-export nerdctl functions
|
||||
pub use nerdctl::register_nerdctl_module;
|
||||
pub use nerdctl::{
|
||||
// Container functions
|
||||
nerdctl_run, nerdctl_run_with_name, nerdctl_run_with_port,
|
||||
nerdctl_exec, nerdctl_copy, nerdctl_stop, nerdctl_remove, nerdctl_list,
|
||||
nerdctl_copy,
|
||||
nerdctl_exec,
|
||||
nerdctl_image_build,
|
||||
nerdctl_image_commit,
|
||||
nerdctl_image_pull,
|
||||
nerdctl_image_push,
|
||||
nerdctl_image_remove,
|
||||
nerdctl_image_tag,
|
||||
// Image functions
|
||||
nerdctl_images, nerdctl_image_remove, nerdctl_image_push, nerdctl_image_tag,
|
||||
nerdctl_image_pull, nerdctl_image_commit, nerdctl_image_build
|
||||
nerdctl_images,
|
||||
nerdctl_list,
|
||||
nerdctl_remove,
|
||||
// Container functions
|
||||
nerdctl_run,
|
||||
nerdctl_run_with_name,
|
||||
nerdctl_run_with_port,
|
||||
nerdctl_stop,
|
||||
};
|
||||
|
||||
// Re-export RFS module
|
||||
pub use rfs::register as register_rfs_module;
|
||||
|
||||
// Re-export git module
|
||||
pub use crate::git::{GitRepo, GitTree};
|
||||
pub use git::register_git_module;
|
||||
pub use crate::git::{GitTree, GitRepo};
|
||||
|
||||
// Re-export text module
|
||||
pub use text::register_text_module;
|
||||
// Re-export text functions directly from text module
|
||||
pub use crate::text::{
|
||||
// Fix functions
|
||||
name_fix, path_fix,
|
||||
// Dedent functions
|
||||
dedent, prefix
|
||||
dedent,
|
||||
// Fix functions
|
||||
name_fix,
|
||||
path_fix,
|
||||
prefix,
|
||||
};
|
||||
|
||||
// Re-export TextReplacer functions
|
||||
@@ -97,27 +121,26 @@ pub use os::copy as os_copy;
|
||||
pub fn register(engine: &mut Engine) -> Result<(), Box<rhai::EvalAltResult>> {
|
||||
// Register OS module functions
|
||||
os::register_os_module(engine)?;
|
||||
|
||||
|
||||
// Register Process module functions
|
||||
process::register_process_module(engine)?;
|
||||
|
||||
|
||||
// Register Buildah module functions
|
||||
buildah::register_bah_module(engine)?;
|
||||
|
||||
|
||||
// Register Nerdctl module functions
|
||||
nerdctl::register_nerdctl_module(engine)?;
|
||||
|
||||
|
||||
// Register Git module functions
|
||||
git::register_git_module(engine)?;
|
||||
|
||||
|
||||
// Register Text module functions
|
||||
text::register_text_module(engine)?;
|
||||
|
||||
|
||||
// Register RFS module functions
|
||||
rfs::register(engine)?;
|
||||
|
||||
|
||||
// Future modules can be registered here
|
||||
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user