[Add] instrumentisto-libwebrtc-bin 131.0.6778.69
[CocoaPods.git] / Scripts / create_pods_and_versions_index.rb
blobb3e81fd1fc177348d21c76d71a353859b5ef6b55
1 #!/usr/bin/env ruby
2 # frozen_string_literal: true
4 require 'cocoapods'
6 source = Pod::Source.new('.')
7 pods = source.pods
8 shards = pods.each_with_object({}) do |pod, hash|
9   shard = source.metadata.path_fragment(pod)[0...-1].join('_')
10   versions = source.versions(pod).map(&:to_s).reverse
11   hash[shard] ||= {}
12   hash[shard][pod] = versions
13 end
15 # write all `all_pods_versions_2_2_2.txt` files that are structured like so:
16 # DfPodTest/0.0.1/0.0.2
17 shards.each do |shard, pods_versions|
18   File.open("#{ARGV[0]}/all_pods_versions_#{shard}.txt", 'w') do |file|
19     pods_versions.keys.sort.each do |pod|
20       row = [pod] + pods_versions[pod].sort
21       file.puts row.join('/')
22     end
23   end
24 end
25 STDERR.puts "Generated #{shards.count} shards"
27 # # write a list of all pods, separated by newline
28 File.open("#{ARGV[0]}/all_pods.txt", 'w') do |file|
29   pods.each do |pod|
30     file.puts pod
31   end
32 end
33 STDERR.puts "Total pod count: #{pods.count}"
34 STDERR.puts "Total podspec count: #{shards.values.map(&:values).flatten.count}"
36 # get a list of all deprecated pods
37 deprecated_podspecs = Dir['Specs/**/*.podspec.json'].sort.select do |podspec_path|
38   podspec = Pod::Specification.from_file(podspec_path)
39   podspec.deprecated?
40 end
42 # write a list of all deprecated podspecs, separated by newline
43 File.open("#{ARGV[0]}/deprecated_podspecs.txt", 'w') do |file|
44   deprecated_podspecs.each do |podspec_path|
45     file.puts podspec_path
46   end
47 end
48 STDERR.puts "Deprecated podspec count: #{deprecated_podspecs.count}"