Skip to content

Commit

Permalink
Land #3022, support Gemfile.local
Browse files Browse the repository at this point in the history
  • Loading branch information
egypt committed Jun 18, 2014
2 parents 5e4a612 + 4ac8e23 commit 5beb43d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,4 +1,6 @@
.bundle
Gemfile.local
Gemfile.local.lock
# Rubymine project directory
.idea
# Sublime Text project directory (not created by ST by default)
Expand Down
22 changes: 21 additions & 1 deletion lib/msfenv.rb
Expand Up @@ -2,7 +2,27 @@
# Use bundler to load dependencies
#

ENV['BUNDLE_GEMFILE'] ||= ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "Gemfile"))
GEMFILE_EXTENSIONS = [
'.local',
''
]

unless ENV['BUNDLE_GEMFILE']
require 'pathname'

msfenv_real_pathname = Pathname.new(__FILE__).realpath
root = msfenv_real_pathname.parent.parent

GEMFILE_EXTENSIONS.each do |extension|
extension_pathname = root.join("Gemfile#{extension}")

if extension_pathname.readable?
ENV['BUNDLE_GEMFILE'] = extension_pathname.to_path
break
end
end
end

begin
require 'bundler/setup'
rescue ::LoadError
Expand Down

0 comments on commit 5beb43d

Please sign in to comment.