Module: Dependabot::Bundler::NativeHelpers
- Defined in:
- lib/dependabot/bundler/native_helpers.rb
Defined Under Namespace
Classes: BundleCommand
Class Method Summary collapse
-
.installed_bundler_version(bundler_major_version) ⇒ Object
Maps the major version unto the specific version we have installed.
- .native_helpers_root ⇒ Object
- .run_bundler_subprocess(function:, args:, bundler_version:, options: {}) ⇒ Object
- .versioned_helper_path(bundler_major_version) ⇒ Object
Class Method Details
.installed_bundler_version(bundler_major_version) ⇒ Object
Maps the major version unto the specific version we have installed
69 70 71 72 73 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 69 def self.installed_bundler_version(bundler_major_version) return Helpers::V1 if bundler_major_version == "1" Helpers::V2 end |
.native_helpers_root ⇒ Object
75 76 77 78 79 80 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 75 def self.native_helpers_root helpers_root = ENV["DEPENDABOT_NATIVE_HELPERS_PATH"] return File.join(helpers_root, "bundler") unless helpers_root.nil? File.("../../../helpers", __dir__) end |
.run_bundler_subprocess(function:, args:, bundler_version:, options: {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 36 def self.run_bundler_subprocess(function:, args:, bundler_version:, options: {}) # Run helper suprocess with all bundler-related ENV variables removed bundler_major_version = bundler_version.split(".").first helpers_path = versioned_helper_path(bundler_major_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: { # Bundler will pick the matching installed major version "BUNDLER_VERSION" => installed_bundler_version(bundler_major_version), "BUNDLE_GEMFILE" => File.join(helpers_path, "Gemfile"), # Prevent the GEM_HOME from being set to a folder owned by root "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
64 65 66 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 64 def self.versioned_helper_path(bundler_major_version) File.join(native_helpers_root, "v#{bundler_major_version}") end |