summaryrefslogtreecommitdiff
path: root/scripts/unpack-test-mapping
blob: 7176f9cecead96dea0ca0fd5fb1a2122d872da48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'json'
require_relative '../tooling/lib/tooling/test_map_packer'

packed_json_mapping, unpacked_json_mapping = ARGV.shift(2)
unless packed_json_mapping && unpacked_json_mapping
  puts "usage: #{__FILE__} <packed_json_mapping> <unpacked_json_mapping>"
  exit 1
end

packed_mapping = JSON.parse(File.read(packed_json_mapping))
mapping = Tooling::TestMapPacker.new.unpack(packed_mapping)

puts "Writing unpacked #{unpacked_json_mapping}"
File.write(unpacked_json_mapping, JSON.generate(mapping))
puts "Saved #{unpacked_json_mapping}."