class Capsium::Reactor::PackageSaver
Folds a mounted package’s base plus its overlay into a NEW versioned .cap (name-version+patch.cap) in the reactor workdir: overlay content files replace, tombstones delete, dataset mutation logs replay into the dataset files (JSON/YAML per the source extension). Manifest, routes and security.json are regenerated, so the saved package passes ‘capsium package validate`.
Public Class Methods
(Mount mount) → void
Source
# File lib/capsium/reactor/package_saver.rb, line 18 def initialize(mount) @mount = mount @package = mount.package @overlay = mount.overlay end
Public Instance Methods
(String workdir) → Hash[String, String]
Source
# File lib/capsium/reactor/package_saver.rb, line 25 def save(workdir) staging_parent = File.join(workdir, "saved") FileUtils.mkdir_p(staging_parent) stage = Dir.mktmpdir("fold-", staging_parent) begin fold_into(stage) output = Packager.new.pack(Package.new(stage), { force: true }) { "path" => output, "sha256" => Digest::SHA256.file(output).hexdigest, "name" => @package.name, "version" => bumped_version } ensure FileUtils.remove_entry(stage) end end
Returns {path, sha256, name, version} of the saved .cap.