From 5e3e210f419e04f43cd0d24a57e55c8f18a46d51 Mon Sep 17 00:00:00 2001 From: Brendan McDevitt Date: Wed, 13 Apr 2022 10:45:50 -0500 Subject: [PATCH] add a helper script to update github_usernames.txt file in data dir from github poc json data we have stored in our db --- lib/tasks/github_usernames_populate.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/tasks/github_usernames_populate.rb diff --git a/lib/tasks/github_usernames_populate.rb b/lib/tasks/github_usernames_populate.rb new file mode 100644 index 0000000..ca8021b --- /dev/null +++ b/lib/tasks/github_usernames_populate.rb @@ -0,0 +1,13 @@ +class GithubUsernamesPopulate + def self.usernames_from_pocs + GithubPoc.pluck(:owner).map {|h| h['login']}.sort.uniq + end + + def self.update_file + fp = '/data_importer/data/github_usernames.txt' + File.open(fp, "w+") do |f| + puts "Updating username file found at #{fp}" + f.puts(usernames_from_pocs) + end + end +end