Class: Ace::Test::EndToEndRunner::Molecules::SandboxRuntimeBuilder
- Inherits:
-
Object
- Object
- Ace::Test::EndToEndRunner::Molecules::SandboxRuntimeBuilder
- Defined in:
- lib/ace/test/end_to_end_runner/molecules/sandbox_runtime_builder.rb
Overview
Builds a sandbox-local Ruby/Bundler runtime for E2E execution.
Constant Summary collapse
- DEFAULT_RUBY_VERSION =
"3.4.9"- DEFAULT_SHARED_RUNTIME_CACHE_ROOT =
".ace-local/test-e2e/runtime-cache"- SHARED_RUNTIME_ENV_KEY =
"ACE_E2E_SHARED_RUNTIME_ROOT"- RUNTIME_CACHE_LAYOUT_VERSION =
1- RESERVED_ENV_KEYS =
%w[ PROJECT_ROOT_PATH ACE_E2E_SOURCE_ROOT ACE_CONFIG_PATH BUNDLE_GEMFILE BUNDLE_APP_CONFIG BUNDLE_USER_HOME BUNDLE_USER_CACHE BUNDLE_USER_CONFIG BUNDLE_PATH BUNDLE_BIN BUNDLE_DISABLE_SHARED_GEMS BUNDLER_VERSION GEM_HOME GEM_PATH RUBYOPT RUBYLIB ].freeze
Instance Method Summary collapse
-
#initialize(source_root:, ruby_version: nil, command_runner: nil) ⇒ SandboxRuntimeBuilder
constructor
A new instance of SandboxRuntimeBuilder.
- #prepare(sandbox_root:, env: {}, tool_names: nil) ⇒ Object
- #prepare_shared_runtime(cache_root: nil, tool_names: nil) ⇒ Object
Constructor Details
#initialize(source_root:, ruby_version: nil, command_runner: nil) ⇒ SandboxRuntimeBuilder
Returns a new instance of SandboxRuntimeBuilder.
36 37 38 39 40 |
# File 'lib/ace/test/end_to_end_runner/molecules/sandbox_runtime_builder.rb', line 36 def initialize(source_root:, ruby_version: nil, command_runner: nil) @source_root = File.(source_root) @ruby_version = (ruby_version || DEFAULT_RUBY_VERSION).to_s.strip @command_runner = command_runner || method(:capture3) end |
Instance Method Details
#prepare(sandbox_root:, env: {}, tool_names: nil) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ace/test/end_to_end_runner/molecules/sandbox_runtime_builder.rb', line 42 def prepare(sandbox_root:, env: {}, tool_names: nil) sandbox_root = File.(sandbox_root) local_runtime_root = File.join(sandbox_root, ".ace-local", "e2e-runtime") runtime_root = resolve_runtime_root(local_runtime_root, env) FileUtils.mkdir_p(runtime_root) unless shared_runtime_root?(env) runtime_env = build_runtime_env( sandbox_root, runtime_root, env, mutable_runtime_root: local_runtime_root ) ensure_runtime_dirs(runtime_env) if shared_runtime_root?(env) ensure_shared_runtime!(runtime_root, tool_names) else prepare_runtime_root!(runtime_root, runtime_env, tool_names) end { runtime_root: runtime_root, env: runtime_env } end |
#prepare_shared_runtime(cache_root: nil, tool_names: nil) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/ace/test/end_to_end_runner/molecules/sandbox_runtime_builder.rb', line 67 def prepare_shared_runtime(cache_root: nil, tool_names: nil) runtime_root = shared_runtime_root(cache_root: cache_root) runtime_env = build_shared_runtime_env(runtime_root) ensure_runtime_dirs(runtime_env) prepare_runtime_root!(runtime_root, runtime_env, tool_names) runtime_root end |