2014-05-12 20:03:51 +00:00
|
|
|
require 'pathname'
|
|
|
|
require 'rubygems'
|
|
|
|
|
2014-06-20 16:38:47 +00:00
|
|
|
GEMFILE_EXTENSIONS = [
|
|
|
|
'.local',
|
|
|
|
''
|
|
|
|
]
|
2014-05-12 20:03:51 +00:00
|
|
|
|
2014-06-20 19:32:29 +00:00
|
|
|
msfenv_real_pathname = Pathname.new(__FILE__).realpath
|
|
|
|
root = msfenv_real_pathname.parent.parent
|
|
|
|
|
2014-06-20 16:38:47 +00:00
|
|
|
unless ENV['BUNDLE_GEMFILE']
|
|
|
|
require 'pathname'
|
2014-05-12 20:03:51 +00:00
|
|
|
|
2014-06-20 16:38:47 +00:00
|
|
|
GEMFILE_EXTENSIONS.each do |extension|
|
|
|
|
extension_pathname = root.join("Gemfile#{extension}")
|
2014-05-12 20:03:51 +00:00
|
|
|
|
2014-06-20 16:38:47 +00:00
|
|
|
if extension_pathname.readable?
|
|
|
|
ENV['BUNDLE_GEMFILE'] = extension_pathname.to_path
|
|
|
|
break
|
|
|
|
end
|
2014-05-12 20:03:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-06-20 16:38:47 +00:00
|
|
|
begin
|
|
|
|
require 'bundler'
|
|
|
|
rescue LoadError
|
|
|
|
$stderr.puts "[*] Metasploit requires the Bundler gem to be installed"
|
|
|
|
$stderr.puts " $ gem install bundler"
|
|
|
|
exit(0)
|
|
|
|
end
|
|
|
|
|
2014-05-12 20:03:51 +00:00
|
|
|
Bundler.setup
|
|
|
|
|
|
|
|
lib_path = root.join('lib').to_path
|
|
|
|
|
|
|
|
unless $LOAD_PATH.include? lib_path
|
|
|
|
$LOAD_PATH.unshift lib_path
|
|
|
|
end
|