Skip to content

Commit 6251dd5

Browse files
committed
Always use bundler to load gems
1 parent 06537e0 commit 6251dd5

File tree

1 file changed

+8
-29
lines changed

1 file changed

+8
-29
lines changed

lib/msfenv.rb

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,12 @@
11
#
2-
# Shim load the bundled gem cache if the environment is set
2+
# Use bundler to load dependencies
33
#
44

5-
_msf_gemcache = false
6-
7-
# If the bundle option is explicitly set, load the gemcache
8-
unless ENV['MSF_BUNDLE_GEMS'].to_s.downcase =~ /^[nf0]/ # NO/FALSE/0
9-
require 'msf/env/gemcache'
10-
_msf_gemcache = true
11-
else
12-
# If the bundle option is empty and this looks like an installer environment
13-
# also load the gem cache (but probably not the binary gem cache)
14-
if ENV['MSF_BUNDLE_GEMS'].to_s.length == 0 and
15-
::File.exists?( File.join( File.dirname(__FILE__), "..", "..", "properties.ini") ) and
16-
::File.directory?( File.join( File.dirname(__FILE__), "..", "..", "apps", "pro") )
17-
require 'msf/env/gemcache'
18-
_msf_gemcache = true
19-
end
20-
end
21-
22-
if not _msf_gemcache
23-
# The user is running outside of the installer environment and not using
24-
# our bundled gemset, so we fallback on bundler instead
25-
ENV['BUNDLE_GEMFILE'] ||= ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "Gemfile"))
26-
begin
27-
require 'bundler/setup'
28-
rescue ::LoadError
29-
$stderr.puts "[*] Metasploit requires the Bundler gem to be installed in development mode"
30-
$stderr.puts " $ rvmsudo gem install bundler"
31-
exit(0)
32-
end
5+
ENV['BUNDLE_GEMFILE'] ||= ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "Gemfile"))
6+
begin
7+
require 'bundler/setup'
8+
rescue ::LoadError
9+
$stderr.puts "[*] Metasploit requires the Bundler gem to be installed"
10+
$stderr.puts " $ gem install bundler"
11+
exit(0)
3312
end

0 commit comments

Comments
 (0)