Skip to content

Commit ff017f8

Browse files
committed
Merge pull request rapid7#105 from rapid7/bug/MSP-10684-electro-installers
MSP-10684 Allow declaring root via env var in gemspecs
2 parents 9addfce + dee6d9c commit ff017f8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

metasploit-framework.gemspec

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# coding: utf-8
2-
# have to use realpath as metasploit-framework is often loaded through a symlink and tools like Coverage and debuggers
3-
# require realpaths.
4-
lib = File.realpath(File.expand_path('../lib', __FILE__))
2+
3+
# During build, the Gemfile is temporarily moved and
4+
# we must manually define the project root
5+
if ENV['MSF_ROOT']
6+
lib = File.realpath(File.expand_path('lib', ENV['MSF_ROOT']))
7+
else
8+
# have to use realpath as metasploit-framework is often loaded through a symlink and tools like Coverage and debuggers
9+
# require realpaths.
10+
lib = File.realpath(File.expand_path('../lib', __FILE__))
11+
end
12+
513
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
614
require 'metasploit/framework/version'
715

0 commit comments

Comments
 (0)