I'm currently stepping through the code of the gitlab_development_kit gem to see how it works.
I'm currently at this line of code, and I've placed a debugger point above and below the line.
3: require 'byebug' 4: byebug 5: => 6: $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) 7: byebug 8: require 'gitlab_development_kit' I inspect the values of $LOAD_PATH and File.expand_path('../../lib', __FILE__):
(byebug) $LOAD_PATH ["/usr/local/Cellar/rbenv/1.1.2/rbenv.d/exec/gem-rehash", ...] (byebug) File.expand_path('../../lib', __FILE__) "/Users/richiethomas/Workspace/ThreeEasyPieces/lib" I type next to advance the debugger, and then re-check the above values:
(byebug) next [2, 11] in /Users/richiethomas/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/gitlab-development-kit-0.2.5/bin/gdk 2: require 'yaml' 3: require 'byebug' 4: byebug 5: 6: $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) => 7: byebug 8: require 'gitlab_development_kit' 9: 10: 11: (byebug) File.expand_path('../../lib', __FILE__) "/Users/richiethomas/Workspace/ThreeEasyPieces/lib" (byebug) $LOAD_PATH ["/Users/richiethomas/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/gitlab-development-kit-0.2.5/lib", "/usr/local/Cellar/rbenv/1.1.2/rbenv.d/exec/gem-rehash", ...] If the value of File.expand_path('../../lib', __FILE__) really was "/Users/richiethomas/Workspace/ThreeEasyPieces/lib", then that's what I would expect to be pre-pended to $LOAD_PATH. But instead, it looks like the lib dir from the version of the gem managed by RBENV was pre-pended instead. What kind of devil's magic is this? :-)