Module: Dependabot::Bundler::NativeHelpers
- Extended by:
- T::Generic, T::Sig
- Defined in:
- lib/dependabot/bundler/native_helpers.rb
Defined Under Namespace
Classes: BundleCommand
Class Method Summary collapse
- .native_helpers_root ⇒ Object
- .run_bundler_subprocess(function:, args:, bundler_version:, options: {}) ⇒ Object
- .versioned_helper_path(bundler_major_version) ⇒ Object
Class Method Details
.native_helpers_root ⇒ Object
89 90 91 92 93 94 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 89 def self.native_helpers_root helpers_root = ENV.fetch("DEPENDABOT_NATIVE_HELPERS_PATH", nil) return File.join(helpers_root, "bundler") unless helpers_root.nil? File.("../../../helpers", __dir__) end |
.run_bundler_subprocess(function:, args:, bundler_version:, options: {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 57 def self.run_bundler_subprocess(function:, args:, bundler_version:, options: {}) # Run helper suprocess with all bundler-related ENV variables removed helpers_path = versioned_helper_path(bundler_version) ::Bundler.with_original_env do command = BundleCommand .new([:timeout_per_operation_seconds]) .build(File.join(helpers_path, "run.rb")) SharedHelpers.run_helper_subprocess( command: command, function: function, args: args, env: { # Set BUNDLE_PATH to a thread-safe location "BUNDLE_PATH" => File.join(Dependabot::Utils::BUMP_TMP_DIR_PATH, ".bundle"), # Set GEM_HOME to where the proper version of Bundler is installed "GEM_HOME" => File.join(helpers_path, ".bundle") } ) rescue SharedHelpers::HelperSubprocessFailed => e # TODO: Remove once we stop stubbing out the V2 native helper raise Dependabot::NotImplemented, e. if e.error_class == "Functions::NotImplementedError" raise end end |
.versioned_helper_path(bundler_major_version) ⇒ Object
84 85 86 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 84 def self.versioned_helper_path(bundler_major_version) File.join(native_helpers_root, "v#{bundler_major_version}") end |