#!/usr/bin/env ruby # -*- encoding: utf-8 -*- # Copyright muflax , 2013 # License: GNU GPL 3 def require_local lib_name, location=__FILE__ file = File.symlink?(location) ? File.readlink(location) : location lib = File.join File.dirname(file), "/../lib/#{lib_name}.rb" if File.exists? lib # using local version require lib else require lib_name end end