Sha256: 04ead69df4afade3d544726f918e9966c6423f889aa25c95eed6b193eaa78df1

Contents?: true

Size: 866 Bytes

Versions: 12

Compression:

Stored size: 866 Bytes

Contents

#! /usr/bin/env ruby

require 'yaml'
require 'open-uri'
require './lib/gman'
require './lib/gman/parser'


current = Gman::Parser.file_to_array( Gman::list_path )
domain_hash = Gman::Parser.array_to_hash(current)
domain_list = domain_hash.flat_map { |k,v| v }

puts "Checking for duplicate domains in the domain list..."
puts "Current list contains #{domain_list.count} domains..."

SOURCE = "https://raw.githubusercontent.com/GSA/govt-urls/master/government-urls.yaml"
source_hash = YAML.load(open(SOURCE).read)
source_list = source_hash.flat_map { |k,v| v }

dupes = []
domain_hash.each do |group,domains|
  domains.each do |domain|
    if domain_list.count(domain) > 1 && source_list.count(domain) <= 1
      dupes.push(domain)
    end
  end
end

dupes.uniq!

puts "Found #{dupes.count} dupes!"

if dupes.count > 0
  puts dupes.inspect
  exit 1
else
  exit 0
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gman-4.6.5 script/dedupe
gman-4.6.4 script/dedupe
gman-4.6.3 script/dedupe
gman-4.6.2 script/dedupe
gman-4.6.1 script/dedupe
gman-4.6.0 script/dedupe
gman-4.5.1 script/dedupe
gman-4.5.0 script/dedupe
gman-4.4.3 script/dedupe
gman-4.4.2 script/dedupe
gman-4.4.1 script/dedupe
gman-4.4.0 script/dedupe