Server IP : 66.29.132.122 / Your IP : 18.116.88.147 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/opt/alt/ruby33/share/gems/gems/bundler-2.5.11/lib/bundler/ |
Upload File : |
# frozen_string_literal: true module Bundler class EnvironmentPreserver INTENTIONALLY_NIL = "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL" BUNDLER_KEYS = %w[ BUNDLE_BIN_PATH BUNDLE_GEMFILE BUNDLER_VERSION BUNDLER_SETUP GEM_HOME GEM_PATH MANPATH PATH RB_USER_INSTALL RUBYLIB RUBYOPT ].map(&:freeze).freeze BUNDLER_PREFIX = "BUNDLER_ORIG_" def self.from_env new(ENV.to_hash, BUNDLER_KEYS) end # @param env [Hash] # @param keys [Array<String>] def initialize(env, keys) @original = env @keys = keys @prefix = BUNDLER_PREFIX end # Replaces `ENV` with the bundler environment variables backed up def replace_with_backup ENV.replace(backup) end # @return [Hash] def backup env = @original.clone @keys.each do |key| value = env[key] if !value.nil? env[@prefix + key] ||= value else env[@prefix + key] ||= INTENTIONALLY_NIL end end env end # @return [Hash] def restore env = @original.clone @keys.each do |key| value_original = env[@prefix + key] next if value_original.nil? if value_original == INTENTIONALLY_NIL env.delete(key) else env[key] = value_original end env.delete(@prefix + key) end env end end end