Skip to content

Commit 5beb43d

Browse files
committed
Land rapid7#3022, support Gemfile.local
2 parents 5e4a612 + 4ac8e23 commit 5beb43d

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.bundle
2+
Gemfile.local
3+
Gemfile.local.lock
24
# Rubymine project directory
35
.idea
46
# Sublime Text project directory (not created by ST by default)

lib/msfenv.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,27 @@
22
# Use bundler to load dependencies
33
#
44

5-
ENV['BUNDLE_GEMFILE'] ||= ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "Gemfile"))
5+
GEMFILE_EXTENSIONS = [
6+
'.local',
7+
''
8+
]
9+
10+
unless ENV['BUNDLE_GEMFILE']
11+
require 'pathname'
12+
13+
msfenv_real_pathname = Pathname.new(__FILE__).realpath
14+
root = msfenv_real_pathname.parent.parent
15+
16+
GEMFILE_EXTENSIONS.each do |extension|
17+
extension_pathname = root.join("Gemfile#{extension}")
18+
19+
if extension_pathname.readable?
20+
ENV['BUNDLE_GEMFILE'] = extension_pathname.to_path
21+
break
22+
end
23+
end
24+
end
25+
626
begin
727
require 'bundler/setup'
828
rescue ::LoadError

0 commit comments

Comments
 (0)