Class: VagrantPlugins::OrbStack::Action::Reload

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-orbstack/action/reload.rb

Overview

Action middleware for reloading (restarting) OrbStack machines.

This is a Composition Action that orchestrates Halt + Start actions rather than directly interacting with OrbStack CLI. Following the composition pattern, this class:

  • Does NOT include MachineValidation (composed actions handle validation)
  • Does NOT directly call OrbStackCLI (delegates to Halt/Start)
  • Does NOT manage state cache (composed actions handle invalidation)

The actual work is performed by the Action::Builder chain in the provider's action method, which composes: Halt → Start → (optional) Provision

This class exists as a pattern consistency marker and for potential future pre/post reload logic that doesn't fit in the composed actions.

See docs/DESIGN.md "Action Patterns" section for pattern documentation.

Examples:

Usage in action builder

Vagrant::Action::Builder.new.tap do |b|
  b.use VagrantPlugins::OrbStack::Action::Reload
end

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ Reload

Initialize the middleware.

Parameters:

  • app (Object)

    The next middleware in the chain

  • env (Hash)

    The environment hash containing :machine, :ui, etc.



36
37
38
# File 'lib/vagrant-orbstack/action/reload.rb', line 36

def initialize(app, _env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

Execute the middleware.

This is a pass-through middleware - the actual reload logic is composed in the provider's action method. This class exists to maintain consistency with the action middleware pattern.

Parameters:

  • env (Hash)

    The environment hash

Returns:

  • (Object)

    Result from next middleware



49
50
51
52
# File 'lib/vagrant-orbstack/action/reload.rb', line 49

def call(env)
  # Continue middleware chain
  @app.call(env)
end