Return mapping of gems to dependency versions
348190
def dependency_tree(args = {}, &bl)
      dependencies = {}
      args = {:recursive    => true,
              :dev_deps     => true,
              :matching     => :latest,
              :dependencies => dependencies}.merge(args)

      process = []
      deps.each do |dep|
        resolved = nil
        begin
          resolved = Polisher::Gem.matching(dep, args[:matching])
        rescue
        end
        yield self, dep, resolved
        process << resolved unless resolved.nil?
      end

      process.each { |dep|
        dependencies.merge!(dep.dependency_tree(args, &bl))
      }

      dependencies
    end
1322525
def compare_version
      c_version = Gem::Version.new(@current_version)
      l_version = Gem::Version.new(@last_version)

      if @current_version.nil? || c_version < l_version
        yield @current_version, @last_version
      end
    end
879379
def clean(plugins, **opts)
      @logger.debug("Cleaning Vagrant plugins of stale gems.")
      # Generate dependencies for all registered plugins
      plugin_deps = plugins.map do |name, info|
        gem_version = info['installed_gem_version']
        gem_version = info['gem_version'] if gem_version.to_s.empty?
        gem_version = "> 0" if gem_version.to_s.empty?
        Gem::Dependency.new(name, gem_version)
      end

      @logger.debug("Current plugin dependency list: #{plugin_deps}")

      # Load dependencies into a request set for resolution
      request_set = Gem::RequestSet.new(*plugin_deps)
      # Never allow dependencies to be remotely satisfied during cleaning
      request_set.remote = false

      # Sets that we can resolve our dependencies from. Note that we only
      # resolve from the current set as all required deps are activated during
      # init.
      current_set = generate_vagrant_set

      # Collect all plugin specifications
      plugin_specs = Dir.glob(plugin_gem_path.join('specifications/*.gemspec').to_s).map do |spec_path|
        Gem::Specification.load(spec_path)
      end

      # Include environment specific specification if enabled
      if env_plugin_gem_path
        plugin_specs += Dir.glob(env_plugin_gem_path.join('specifications/*.gemspec').to_s).map do |spec_path|
          Gem::Specification.load(spec_path)
        end
      end

      @logger.debug("Generating current plugin state solution set.")

      # Resolve the request set to ensure proper activation order
      solution = request_set.resolve(current_set)
      solution_specs = solution.map(&:full_spec)
      solution_full_names = solution_specs.map(&:full_name)

      # Find all specs installed to plugins directory that are not
      # found within the solution set.
      plugin_specs.delete_if do |spec|
        solution_full_names.include?(spec.full_name)
      end

      if env_plugin_gem_path
        # If we are cleaning locally, remove any global specs. If
        # not, remove any local specs
        if opts[:env_local]
          @logger.debug("Removing specifications that are not environment local")
          plugin_specs.delete_if do |spec|
            spec.full_gem_path.to_s.include?(plugin_gem_path.realpath.to_s)
          end
        else
          @logger.debug("Removing specifications that are environment local")
          plugin_specs.delete_if do |spec|
            spec.full_gem_path.to_s.include?(env_plugin_gem_path.realpath.to_s)
          end
        end
      end

      @logger.debug("Specifications to be removed - #{plugin_specs.map(&:full_name)}")

      # Now delete all unused specs
      plugin_specs.each do |spec|
        @logger.debug("Uninstalling gem - #{spec.full_name}")
        Gem::Uninstaller.new(spec.name,
          version: spec.version,
          install_dir: plugin_gem_path,
          all: true,
          executables: true,
          force: true,
          ignore: true,
        ).uninstall_gem(spec)
      end

      solution.find_all do |spec|
        plugins.keys.include?(spec.name)
      end
    end
1331614
def version_task
      update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']
      update_gemspec(:date, Date.today)

      update_version_file(gemspec.version)
      update_version_constant(gemspec.version)
    end
1358101
def cmd_version(unused_conf):
    """"""
    import pkg_resources
    print('This is {} version {}, imported from {}'
          .format(__oneliner__, __version__, __file__))
    if len(Plugin.builders) > 0:
        print('setuptools registered builders:')
    for entry_point in pkg_resources.iter_entry_points('yabt.builders'):
        print('  {0.module_name}.{0.name} (dist {0.dist})'.format(entry_point))
1205661
def gem_dependencies(gem_name)
      Utils.cache.cache(gem_name) do
        gems = Utils.gems_collection(false)
        gem_collection = gems.find_by_name(gem_name)

        return '' if gem_collection.nil?

        gem_collection = Parallel.map(gem_collection, in_threads: 4) do |gem|
          [gem, spec_for(gem.name, gem.number, gem.platform)]
        end
        gem_collection.reject! do |_, spec|
          spec.nil?
        end

        Parallel.map(gem_collection, in_threads: 4) do |gem, spec|
          dependencies = spec.dependencies.select do |d|
            d.type == :runtime
          end

          dependencies = Parallel.map(dependencies, in_threads: 4) do |d|
            [d.name.is_a?(Array) ? d.name.first : d.name, d.requirement.to_s]
          end

          {
            name: gem.name,
            number: gem.number,
            platform: gem.platform,
            dependencies: dependencies
          }
        end
      end
    end
133913
def _get_version(name, results):
    '''
    
    '''
    for line in salt.utils.itertools.split(results, '\n'):
        if not line:
            continue
        try:
            pkgname, pkgver = line.rsplit('-', 1)
        except ValueError:
            continue
        if pkgname == name:
            return pkgver
    return None
374334
def outdated
      outdateds = []

      latest_specs.each do |local|
        dependency = Gem::Dependency.new local.name, ">= #{local.version}"

        begin
          fetcher = Gem::SpecFetcher.fetcher
          remotes = fetcher.find_matching dependency
          remotes = remotes.map { |(name, version,_),_| version }
        rescue Gem::RemoteFetcher::FetchError => e
          raise unless fetcher.warn_legacy e do
            require 'rubygems/source_info_cache'

            specs = Gem::SourceInfoCache.search_with_source dependency, true

            remotes = specs.map { |spec,| spec.version }
          end
        end

        latest = remotes.sort.last

        outdateds << local.name if latest and local.version < latest
      end

      outdateds
    end
867385
def yank_version(name, version, options = {})
      ensure_ready!(:authorization)
      url = "gems/#{escape(name)}/versions/#{escape(version)}"
      response = connection.delete(url, options)
      checked_response_body(response)
    end
741296
def versions(name, options = {})
      ensure_ready!(:authorization)
      url = "gems/#{escape(name)}/versions"
      response = connection.get(url, options)
      checked_response_body(response)
    end
261467
function getDependencies(platform, bundleEntry) {
    return packagerServer.getDependencies({
      platform: platform,
      dev: true,
      hot: true,
      entryFile: bundleEntry,
    }).then(response => {
      const {getModuleId} = response;

      // for each dependency builds the object:
      // `{path: '/a/b/c.js', deps: ['modA', 'modB', ...]}`
      return Promise.all(Object.values(response.dependencies).map(dep => {
        return dep.getName().then(depName => {
          if (dep.isAsset() || dep.isAsset_DEPRECATED() || dep.isJSON()) {
            return Promise.resolve({path: dep.path, deps: []});
          }
          return packagerServer.getShallowDependencies({
            platform: platform,
            dev: true,
            hot: true,
            entryFile: dep.path
          })
            .then(deps => {
              return {
                path: dep.path,
                name: depName,
                deps,
              };
            });
        });
      }))
      .then(deps => {
        // list with all the dependencies' filenames the bundle entry has
        const dependenciesCache = response.dependencies.map(dep => dep.path);

        // map from module name to path
        const moduleToFilenameCache = Object.create(null);
        deps.forEach(dep => {
          moduleToFilenameCache[dep.name] = dep.path;
        });

        // map that indicates the shallow dependency each file included on the
        // bundle has
        const shallowDependencies = Object.create(null);
        deps.forEach(dep => {
          shallowDependencies[dep.path] = dep.deps;
        });

        // map from module name to the modules' dependencies the bundle entry
        // has
        const dependenciesModulesCache = Object.create(null);
        response.dependencies.forEach(dep => {
          dependenciesModulesCache[getModuleId(dep)] = dep;
        });


        const inverseDependenciesCache = Object.create(null);
        const inverseDependencies = getInverseDependencies(response);
        for (const [module, dependents] of inverseDependencies) {
          inverseDependenciesCache[getModuleId(module)] =
            Array.from(dependents).map(getModuleId);
        }

        return {
          dependenciesCache,
          dependenciesModulesCache,
          shallowDependencies,
          inverseDependenciesCache,
          resolutionResponse: response,
        };
      });
    });
  }
197213
def ignore_gem(name, version, platform)
      ignored_gems[platform] ||= {}
      ignored_gems[platform][name] ||= []
      ignored_gems[platform][name] << version
    end
568331
def fill_changes(old_gem, updated_gem)
      changes[old_gem.name] = {
        versions: {
          old: old_gem.version.to_s, new: updated_gem.version.to_s
        },
        source: updated_gem.source
      }
    end
690306
function fetchUnmetDependencies() {
        var runAgain = false;
        for (var id in dependencyMap) {
            _.forEach(dependencyMap[id], function (depId) {
                if (!dependencyMap[depId] && !injectedMap[depId]) {
                    try {
                        loadExternalModule(id, depId);
                    } catch (err) {
                        throw new Error('Error loading dependency ' + depId + ' for ' + id + ': ' + err.message);
                    }

                    runAgain = true;
                }
            });
        }

        if (runAgain) { //continue until all we don't have any more unmet dependencies
            fetchUnmetDependencies();
        }
    }
945876
def to_gem_version raw
      std_ver = raw.chomp.gsub(' ','.').delete('(').delete(')')
      Gem::Version.new std_ver
    end
569610
function dependenciesToArray(dependencies) {
    return zipWith((name, version) => ({ name, version }),
        keys(dependencies),
        values(dependencies));
}
877473
def map_specifiers_to_versions
      specifiers = {}
      processed = {}

      l = lambda do |t|
        return if processed[t.object_id]
        processed[t.object_id] = true
        t.dependencies.each do |package, spec|
          specifiers[package] ||= {}
          specifiers[package][spec.clause] ||= []
          specifiers[package][spec.clause] << spec
          spec.versions.each_value {|v| l[v]}
        end
      end

      l[@tree]
      specifiers
    end