Sha256: 350791074911f9c8c054803c50c7a5a5a8b7c4eafccc491cf719d52b8b111066

Contents?: true

Size: 1.21 KB

Versions: 32

Compression:

Stored size: 1.21 KB

Contents

require "openssl"
require "net/http" unless defined?(Net::HTTP)
require "json" unless defined?(JSON)
require "uri"

UNIVERSE_JSON_PATH = File.join(__dir__, "universe.json")
SMALL_UNIVERSE_JSON_PATH = File.join(__dir__, "small_universe.json")
PRUNED_UNIVERSE_PATH = File.join(__dir__, "pruned_small_universe.json")

COOKBOOKS_IN_SMALL_UNIVERSE = %w{apache2 application apt database mysql nginx postgresql yum}.freeze

universe = URI("https://supermarket.chef.io/universe")

universe_serialized = Net::HTTP.get(universe)

universe = JSON.parse(universe_serialized)

smaller_universe = universe.keep_if { |k, v| COOKBOOKS_IN_SMALL_UNIVERSE.include?(k) }

pruned_universe = smaller_universe.inject({}) do |pruned_graph, (cookbook_name, graph_info)|
  pruned_graph[cookbook_name] = graph_info.inject({}) do |per_version_graph, (version_number, version_info)|
    per_version_graph[version_number] = version_info["dependencies"]
    per_version_graph
  end
  pruned_graph
end

File.open(UNIVERSE_JSON_PATH, "w+") { |f| f.print(universe_serialized) }
File.open(SMALL_UNIVERSE_JSON_PATH, "w+") { |f| f.print(JSON.pretty_generate(smaller_universe)) }
File.open(PRUNED_UNIVERSE_PATH, "w+") { |f| f.print(JSON.pretty_generate(pruned_universe)) }

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
chef-cli-5.6.16 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.6.14 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.6.13 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.6.12 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.6.11 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.6.8 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.6.1 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.6.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.5.6 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.5.5 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.5.4 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.5.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.4.2 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.4.1 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.3.1 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.3.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.2.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.1.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-5.0.1 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-cli-4.0.1 spec/unit/fixtures/cookbooks_api/update_fixtures.rb