blob: 3e6c89f4503f8f8fe0daa9d50bdc641a5f294006 [file] [log] [blame]
require 'bundler'
require 'whimsy/asf/config'
module Bundler
#
# modify bundler to be aware of whimsy library overrides
#
class Dsl
bundler_gem = instance_method(:gem)
libs = ASF::Config.get(:lib)
define_method :gem do |name, *args|
pname = name.gsub('-', '/')
path = nil
libs.each do |lib|
if File.exist?("#{lib}/#{pname}")
path = lib
end
end
if path
args.push({}) unless args.last.is_a?(Hash)
args.last[:path] = File.dirname(path)
end
bundler_gem.bind(self).(name, *args)
end
end
end
require 'bundler/setup'