ruby-win32/lib/ruby/site_ruby/1.8/rubygems.rb
# Activate a gem (i.e. add it to the Ruby load path).  The gem
# must satisfy all the specified version constraints.  If
# +autorequire+ is true, then automatically require the specified
# autorequire file in the gem spec.
#
# Returns true if the gem is loaded by this call, false if it is
# already loaded, or an exception otherwise.
#
Activate a gem .  The gem
must satisfy all the specified version constraints.  If
+autorequire+ is true, then automatically require the specified
autorequire file in the gem spec.

Returns true if the gem is loaded by this call, false if it is
already loaded, or an exception otherwise.
Activate a gem . The gem must satisfy all the specified version constraints . If + autorequire + is true then automatically require the specified autorequire file in the gem spec . Returns true if the gem is loaded by this call false if it is already loaded or an exception otherwise .
def activate(gem, autorequire, *version_requirements)
      if version_requirements.empty? then
        version_requirements = Gem::Requirement.default
      end
      unless gem.respond_to?(:name) && gem.respond_to?(:version_requirements)
        gem = Gem::Dependency.new(gem, version_requirements)
      end
      matches = Gem.source_index.find_name(gem.name, gem.version_requirements)
      report_activate_error(gem) if matches.empty?
      if @loaded_specs[gem.name]
        existing_spec = @loaded_specs[gem.name]
        if ! matches.any? { |spec| spec.version == existing_spec.version }
          fail Gem::Exception, "can't activate #{gem}, already activated #{existing_spec.full_name}]"
        end
        return false
      end
      spec = matches.last
      if spec.loaded?
        return false unless autorequire
        result = spec.autorequire ? require(spec.autorequire) : false
        return result || false
      end
      spec.loaded = true
      @loaded_specs[spec.name] = spec
      spec.dependencies.each do |dep_gem|
        activate(dep_gem, autorequire)
      end
      spec.require_paths.unshift spec.bindir if spec.bindir
      require_paths = spec.require_paths.map do |path|
        File.join spec.full_gem_path, path
      end
      sitelibdir = ConfigMap[:sitelibdir]
      $:.insert($:.index(sitelibdir), *require_paths)
      if autorequire && spec.autorequire then 
        Array(spec.autorequire).each do |a_lib|
          require a_lib
        end
      end
      return true
    end
def activate ( gem , autorequire , * version_requirements ) if version_requirements . empty? then version_requirements = Gem :: Requirement . default end unless gem . respond_to? ( :name ) && gem . respond_to? ( :version_requirements ) gem = Gem :: Dependency . new ( gem , version_requirements ) end matches = Gem . source_index . find_name ( gem . name , gem . version_requirements ) report_activate_error ( gem ) if matches . empty? if @loaded_specs [ gem . name ] existing_spec = @loaded_specs [ gem . name ] if ! matches . any? { | spec | spec . version == existing_spec . version } fail Gem :: Exception , "can't activate #{gem}, already activated #{existing_spec.full_name}]" end return false end spec = matches . last if spec . loaded? return false unless autorequire result = spec . autorequire ? require ( spec . autorequire ) : false return result || false end spec . loaded = true @loaded_specs [ spec . name ] = spec spec . dependencies . each do | dep_gem | activate ( dep_gem , autorequire ) end spec . require_paths . unshift spec . bindir if spec . bindir require_paths = spec . require_paths . map do | path | File . join spec . full_gem_path , path end sitelibdir = ConfigMap [ :sitelibdir ] $: . insert ( $: . index ( sitelibdir ) , * require_paths ) if autorequire && spec . autorequire then Array ( spec . autorequire ) . each do | a_lib | require a_lib end end return true end
Activate a gem (i.e.
Activate a gem ( i . e .
# This gem is already loaded.  If the currently loaded gem is # not in the list of candidate gems, then we have a version # conflict. # new load # Load dependent gems first # bin directory must come before library directories # gem directories must come after -I and ENV['RUBYLIB'] # Now autorequire # DEPRECATED
gem
autorequire
version_requirements