class Jars::MavenFactory
def add_gem_to_load_path(name)
def add_gem_to_load_path(name) # if the gem is already activated => good return if Gem.loaded_specs[name] # just install gem if needed and add it to the load_path # and leave activated gems as they are req = requirement(name) unless (spec = find_spec_via_rubygems(name, req)) spec = install_gem(name, req) end raise "failed to resolve gem '#{name}' if you're using Bundler add it as a dependency" unless spec path = File.join(spec.full_gem_path, spec.require_path) $LOAD_PATH << path unless $LOAD_PATH.include?(path) end