Class: PromptObjects::Env::Exporter
- Inherits:
-
Object
- Object
- PromptObjects::Env::Exporter
- Defined in:
- lib/prompt_objects/environment/exporter.rb
Overview
Exports an environment as a git bundle (.dump file — Declarative Unified Memory Package). The bundle contains all commits, objects, primitives, and manifest. Sessions are NOT included (private data).
Instance Method Summary collapse
-
#export(output_path, commit_message: nil) ⇒ Hash
Export the environment to a git bundle.
-
#initialize(env_path) ⇒ Exporter
constructor
A new instance of Exporter.
Constructor Details
#initialize(env_path) ⇒ Exporter
Returns a new instance of Exporter.
11 12 13 14 |
# File 'lib/prompt_objects/environment/exporter.rb', line 11 def initialize(env_path) @env_path = env_path @name = File.basename(env_path) end |
Instance Method Details
#export(output_path, commit_message: nil) ⇒ Hash
Export the environment to a git bundle.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/prompt_objects/environment/exporter.rb', line 20 def export(output_path, commit_message: nil) validate_environment! # Ensure we have a clean state commit_changes() if Git.dirty?(@env_path) # Create the bundle output_path = normalize_output_path(output_path) success = Git.bundle(@env_path, output_path) unless success return { success: false, error: "Failed to create git bundle" } end { success: true, path: output_path, stats: gather_stats } end |