Top Level Namespace

Defined Under Namespace

Modules: Jars

Instance Method Summary collapse

Instance Method Details

#require_jar(*args, &block) ⇒ Object



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/jar_dependencies.rb', line 390

def require_jar(*args, &block)
  return unless Jars.require?

  result = Jars.require_jar(*args, &block)
  if result.is_a?(String)
    args << (yield || Jars::UNKNOWN) if args.size == 2 && block
    coordinate = args[0..-2].join(':')
    unless Jars.locked_jar?(coordinate)
      Jars.warn do
        "jar conflict: #{coordinate} already loaded with version #{result}; " \
          "skipping requested version #{args[-1]}"
      end
    end
    Jars.debug("\n\t#{caller.join("\n\t")}") if Jars.debug?
    return false
  end
  Jars.debug { "jar registration: #{args.inspect}; loaded=#{result}" }
  result
end