class Bundler::Runtime
def require(*groups)
def require(*groups) groups.map!(&:to_sym) groups = [:default] if groups.empty? @definition.dependencies.each do |dep| # Skip the dependency if it is not in any of the requested groups, or # not for the current platform, or doesn't match the gem constraints. next unless (dep.groups & groups).any? && dep.should_include? required_file = nil begin # Loop through all the specified autorequires for the # dependency. If there are none, use the dependency's name # as the autorequire. Array(dep.autorequire || dep.name).each do |file| # Allow `require: true` as an alias for `require: <name>` file = dep.name if file == true required_file = file begin Kernel.require file rescue RuntimeError => e raise e if e.is_a?(LoadError) # we handle this a little later raise Bundler::GemRequireError.new e, "There was an error while trying to load the gem '#{file}'." end end rescue LoadError => e raise if dep.autorequire || e.path != required_file if dep.autorequire.nil? && dep.name.include?("-") begin namespaced_file = dep.name.tr("-", "/") Kernel.require namespaced_file rescue LoadError => e raise if e.path != namespaced_file end end end end end