Packs a software stack into a stack bundle. # Arguments `source` - A string slice that holds the path to the source directory.
(source: &str)
| 99 | /// |
| 100 | /// * `source` - A string slice that holds the path to the source directory. |
| 101 | pub fn pack(source: &str) { |
| 102 | println!("4"); |
| 103 | let source_path = if source == "." { |
| 104 | env::current_dir().expect("Failed to get current directory") |
| 105 | } else { |
| 106 | std::path::PathBuf::from(source) |
| 107 | }; |
| 108 | |
| 109 | debug!("Source: {:?}", source_path); |
| 110 | |
| 111 | // Update output filename to include .gz extension |
| 112 | let output_name = source_path |
| 113 | .file_name() |
| 114 | .unwrap_or_else(|| std::ffi::OsStr::new("stack")) |
| 115 | .to_string_lossy() |
| 116 | .to_string(); |
| 117 | let output_path = std::path::PathBuf::from(format!("{}.stack", output_name)); |
| 118 | |
| 119 | // Create the archive |
| 120 | match create_archive(&source_path, &output_path) { |
| 121 | Ok(()) => info!("✅ Stack bundle packed: {:?}", output_path), |
| 122 | Err(e) => error!("Failed to create stack bundle: {e}"), |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | /// Runs a software stack from a stack bundle. |
| 127 | /// |