hummingbird-me/kitsu-server

View on GitHub
bin/util/format_geolite2_locations_csv

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'csv'

ARGV.each do |file|
  CSV.open(file, 'r', headers: true).each do |row|
    puts CSV.generate_line([
      row['geoname_id'],
      row['continent_code'],
      row['continent_name'],
      row['country_iso_code'],
      row['country_name'],
      row['subdivision_1_iso_code'],
      row['subdivision_1_name'],
      row['subdivision_2_iso_code'],
      row['subdivision_2_name'],
      row['city_name'],
    ])
  end
end