From 23377146a32534e6a547db77d63595f39d643a98 Mon Sep 17 00:00:00 2001 From: hahwul Date: Mon, 15 Aug 2022 23:04:15 +0900 Subject: [PATCH] y --- scripts/migration.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/migration.rb b/scripts/migration.rb index d499d67..5dd7dc6 100644 --- a/scripts/migration.rb +++ b/scripts/migration.rb @@ -1,5 +1,6 @@ require 'json' require 'yaml' +require "uri" def get_os install lst = [] @@ -15,6 +16,10 @@ def get_os install return lst end +def get_urls str + return URI.extract(str).uniq +end + file = File.read('./data.json') data_hash = JSON.parse(file) @@ -24,7 +29,7 @@ data_hash.each do | name, obj | new_obj = {} new_obj['name'] = name new_obj['description'] = obj['Description'] - new_obj['url'] = '' # parse DATA + new_obj['urls'] = get_urls obj['Data'] new_obj['category'] = 'tool' new_obj['types'] = [] if obj['Install'] != nil