Module: Dependabot::Bundler::NativeHelpers
- Defined in:
- lib/dependabot/bundler/native_helpers.rb
Class Method Summary collapse
- .helper_path(bundler_version:) ⇒ Object
- .native_helpers_root ⇒ Object
- .run_bundler_subprocess(function:, args:, bundler_version:) ⇒ Object
- .versioned_helper_path(bundler_version:) ⇒ Object
Class Method Details
.helper_path(bundler_version:) ⇒ Object
37 38 39 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 37 def self.helper_path(bundler_version:) "bundle exec ruby #{File.join(versioned_helper_path(bundler_version: bundler_version), 'run.rb')}" end |
.native_helpers_root ⇒ Object
41 42 43 44 45 46 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 41 def self.native_helpers_root helpers_root = ENV["DEPENDABOT_NATIVE_HELPERS_PATH"] return File.join(helpers_root, "bundler") unless helpers_root.nil? File.join(__dir__, "../../../helpers") end |
.run_bundler_subprocess(function:, args:, bundler_version:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 9 def self.run_bundler_subprocess(function:, args:, bundler_version:) # Run helper suprocess with all bundler-related ENV variables removed ::Bundler.with_original_env do SharedHelpers.run_helper_subprocess( command: helper_path(bundler_version: bundler_version), function: function, args: args, env: { # Bundler will pick the matching installed major version "BUNDLER_VERSION" => bundler_version, "BUNDLE_GEMFILE" => File.join(versioned_helper_path(bundler_version: bundler_version), "Gemfile"), # Prevent the GEM_HOME from being set to a folder owned by root "GEM_HOME" => File.join(versioned_helper_path(bundler_version: bundler_version), ".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_version:) ⇒ Object
32 33 34 35 |
# File 'lib/dependabot/bundler/native_helpers.rb', line 32 def self.versioned_helper_path(bundler_version:) native_helper_version = "v#{bundler_version}" File.join(native_helpers_root, native_helper_version) end |