Class: Aspera::Cli::Bootstrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/aspera/cli/bootstrapper.rb

Overview

Performs one-time bootstrap of all shared services into Context. Called by Runner before instantiating Plugins::Config, so that Config acts only as a CLI plugin (option declaration + command handlers).

Responsibilities:

- resolve context.main_folder (option :home)
- populate context.persistency, context.presets, context.http_config, context.progress_bar
- register plugin lookup folders
- register @preset / @vault extended-value handlers
- configure global singletons: RestParameters, OAuth::Factory, SSL, Transfer::Parameters,
RestErrorAnalyzer
- set up the PAC proxy executor (option :fpac)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Bootstrapper

Returns a new instance of Bootstrapper.

Parameters:

  • context (Context)

    the shared context to populate



68
69
70
71
72
# File 'lib/aspera/cli/bootstrapper.rb', line 68

def initialize(context)
  Aspera.assert_type(context, Context){'context'}
  @context = context
  @pac_exec = nil
end

Instance Attribute Details

#config_file_optionObject

Public accessor used as option handler for :config_file



92
93
94
# File 'lib/aspera/cli/bootstrapper.rb', line 92

def config_file_option
  @config_file_option
end

Instance Method Details

#run(gem_plugins_folder:, vault_value_cb:) ⇒ Object

Run the full bootstrap sequence. Must be called after context.options and context.formatter are set. On return, context.persistency, context.presets, context.http_config and context.progress_bar are populated and all global singletons are configured.

Parameters:

  • gem_plugins_folder (String)

    folder of built-in plugins (from Plugins::Config)

  • vault_value_cb (Proc)

    block(name): secret value (from VaultManager)



81
82
83
84
85
86
87
88
89
# File 'lib/aspera/cli/bootstrapper.rb', line 81

def run(gem_plugins_folder:, vault_value_cb:)
  setup_main_folder
  setup_persistency_and_plugin_folders(gem_plugins_folder)
  setup_config_file
  setup_extended_value_handlers(vault_value_cb)
  setup_progress_bar
  setup_pac_executor
  setup_rest_and_transfer_runtime
end