Always use bundler to load gems

unstable
Brandon Turner 2013-01-08 22:58:45 -06:00
parent 06537e0ab1
commit 6251dd571e
1 changed files with 8 additions and 29 deletions

View File

@ -1,33 +1,12 @@
#
# Shim load the bundled gem cache if the environment is set
# Use bundler to load dependencies
#
_msf_gemcache = false
# If the bundle option is explicitly set, load the gemcache
unless ENV['MSF_BUNDLE_GEMS'].to_s.downcase =~ /^[nf0]/ # NO/FALSE/0
require 'msf/env/gemcache'
_msf_gemcache = true
else
# If the bundle option is empty and this looks like an installer environment
# also load the gem cache (but probably not the binary gem cache)
if ENV['MSF_BUNDLE_GEMS'].to_s.length == 0 and
::File.exists?( File.join( File.dirname(__FILE__), "..", "..", "properties.ini") ) and
::File.directory?( File.join( File.dirname(__FILE__), "..", "..", "apps", "pro") )
require 'msf/env/gemcache'
_msf_gemcache = true
end
end
if not _msf_gemcache
# The user is running outside of the installer environment and not using
# our bundled gemset, so we fallback on bundler instead
ENV['BUNDLE_GEMFILE'] ||= ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "Gemfile"))
begin
require 'bundler/setup'
rescue ::LoadError
$stderr.puts "[*] Metasploit requires the Bundler gem to be installed in development mode"
$stderr.puts " $ rvmsudo gem install bundler"
exit(0)
end
ENV['BUNDLE_GEMFILE'] ||= ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "Gemfile"))
begin
require 'bundler/setup'
rescue ::LoadError
$stderr.puts "[*] Metasploit requires the Bundler gem to be installed"
$stderr.puts " $ gem install bundler"
exit(0)
end