#!/usr/bin/env ruby # -*- encoding: utf-8 -*- # Copyright Freya Dorn , 2013 # License: GNU GPL 3 def require_local lib_name, location=caller_locations.first.path file = File.symlink?(location) ? File.readlink(location) : location dir = File.dirname(file) lib = File.join(dir, "#{lib_name}.rb") raise "couldn't find local module: «#{lib_name}» in «#{dir}»" if not File.exist? lib require lib end