collect_tool_versions

in lib/gdk/tool_versions_updater.rb [39:75]


    def collect_tool_versions
      git_fetch_version_files

      
      service_names = self.class.enabled_services
      service_names.push('gitlab', 'gitlab-shell')

      services = []
      service_names.each do |name|
        config_key = name.tr('-', '_')
        repo_url = GDK.config.repositories[config_key]

        services << [name, repo_url, config_key] if repo_url
      end

      GDK::Output.info("Found #{services.size} services with repositories")

      threads = services.map do |name, repo_url, config_key|
        Thread.new do
          config = GDK.config[config_key]
          version = get_version(config)

          Thread.current[:tools] = fetch_service_tool_versions(name, repo_url, version)
        end
      end

      threads << Thread.new do
        Thread.current[:tools] = root_tool_versions
      end

      threads
        .flat_map { |thread| thread.join[:tools] }
        .select { |x| x }
        .group_by(&:first)
        .transform_values { |x| x.flat_map(&:last).uniq }
    end