From 015d77c97eb7a6b00b1606151925c240feaf5003 Mon Sep 17 00:00:00 2001 From: ChaYoung You Date: Tue, 8 Jul 2014 19:46:34 +0900 Subject: [PATCH] Load global gems when using Bundler https://github.com/bundler/bundler/issues/183#issuecomment-1149953 --- irbrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/irbrc b/irbrc index 5ee8a4a..a36589e 100644 --- a/irbrc +++ b/irbrc @@ -1,3 +1,15 @@ +# https://github.com/bundler/bundler/issues/183#issuecomment-1149953 +if defined?(::Bundler) + global_gemset = ENV["GEM_PATH"].split(":").grep(/ruby.*@global/).first + if global_gemset + all_global_gem_paths = Dir.glob("#{global_gemset}/gems/*") + all_global_gem_paths.each do |p| + gem_path = "#{p}/lib" + $LOAD_PATH << gem_path + end + end +end + IRB.conf[:AUTO_INDENT] = true IRB.conf[:PROMPT_MODE] = :SIMPLE