Class: NewBridge::Bootstrap::WindowsBootstrap

Inherits:
Object
  • Object
show all
Defined in:
lib/new_bridge/bootstrap/windows_bootstrap.rb

Overview

Windows-first bootstrap executed from WSL. Supports:

  • --check: diagnostics only
  • --apply: apply WSL-side fixes when possible

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out: $stdout, err: $stderr, command_runner: nil, env: ENV, wsl_override: nil) ⇒ WindowsBootstrap

Returns a new instance of WindowsBootstrap.



14
15
16
17
18
19
20
21
22
23
# File 'lib/new_bridge/bootstrap/windows_bootstrap.rb', line 14

def initialize(out: $stdout, err: $stderr, command_runner: nil, env: ENV, wsl_override: nil)
  @out = out
  @err = err
  @runner = command_runner || method(:default_runner)
  @env = env
  @wsl_override = wsl_override
  @checks = []
  @actions = []
  @selected_runtime_mode = :docker
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



12
13
14
# File 'lib/new_bridge/bootstrap/windows_bootstrap.rb', line 12

def actions
  @actions
end

#checksObject (readonly)

Returns the value of attribute checks.



12
13
14
# File 'lib/new_bridge/bootstrap/windows_bootstrap.rb', line 12

def checks
  @checks
end

Instance Method Details

#run(mode: :check, runtime_mode: :docker) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/new_bridge/bootstrap/windows_bootstrap.rb', line 25

def run(mode: :check, runtime_mode: :docker)
  unless %i[check apply].include?(mode)
    raise ArgumentError, "invalid mode=#{mode} (expected :check or :apply)"
  end

  @selected_runtime_mode = resolve_runtime_mode(runtime_mode)
  header(mode)
  evaluate_checks

  if mode == :apply
    apply_fixes_for_selected_runtime
    evaluate_checks(reset: true)
  end

  summary(mode)
end