6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/openvox_agent_rubygems.rb', line 6
def self.activate!
return false unless packaged_agent_ruby?
unless ENV.key?('GEM_HOME') || ENV.key?('GEM_PATH')
restore_paths!
return !@gem_paths.nil?
end
original_paths = Gem.path
ENV.delete('GEM_HOME')
ENV.delete('GEM_PATH')
Gem.clear_paths
agent_paths = Gem.path.reject { |path| user_ruby_path?(path) }
preserved_paths = original_paths.reject { |path| user_ruby_path?(path) }
combined_paths = (preserved_paths + agent_paths).uniq
@gem_home = combined_paths.first
@gem_paths = combined_paths
restore_paths!
add_gem_require_paths!(preserved_paths)
true
end
|