Sha256: 40f57852cb3c37d43592699a380df66d7dea95d33e89db28fc43fb8e61c53562

Contents?: true

Size: 1.25 KB

Versions: 22

Compression:

Stored size: 1.25 KB

Contents

require 'openssl'
require 'net/https'
require 'json'
require 'pp'
require 'uri'

THIS_DIR = File.expand_path(File.dirname(__FILE__))

UNIVERSE_JSON_PATH = File.join(THIS_DIR, 'universe.json')
SMALL_UNIVERSE_JSON_PATH = File.join(THIS_DIR, 'small_universe.json')
PRUNED_UNIVERSE_PATH = File.join(THIS_DIR, 'pruned_small_universe.json')

COOKBOOKS_IN_SMALL_UNIVERSE = ["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

22 entries across 22 versions & 1 rubygems

Version Path
chef-dk-1.2.22 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-1.2.20 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-1.1.16 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-1.0.3 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.19.6 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.18.30 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.18.26 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.17.17 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.16.28 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.14.25 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.11.2 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.11.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.10.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.8.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.7.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.6.2 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.6.1 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.6.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.5.1 spec/unit/fixtures/cookbooks_api/update_fixtures.rb
chef-dk-0.5.0 spec/unit/fixtures/cookbooks_api/update_fixtures.rb