Module: Dependabot::Bundler::NativeHelpers
- 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
65 66 67 68 69 70 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 65 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 |
# 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 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: { "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
61 62 63 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 61 def self.versioned_helper_path(bundler_major_version) File.join(native_helpers_root, "v#{bundler_major_version}") end |