import syntax updates for rubocop

This commit is contained in:
Priit Tark 2015-04-02 14:37:08 +03:00
parent 3d78dc97cd
commit c239460d6c

View file

@ -59,44 +59,46 @@ namespace :import do
6 => Contact::IDENT_BIRTHDAY 6 => Contact::IDENT_BIRTHDAY
} }
contact_columns = [ contact_columns = %w(
"code", code
"phone", phone
"email", email
"fax", fax
"created_at", created_at
"ident", ident
"ident_type", ident_type
"auth_info", auth_info
"name", name
"org_name", org_name
"registrar_id", registrar_id
"creator_str", creator_str
"updator_str", updator_str
"ident_country_code", ident_country_code
"legacy_id" legacy_id
] )
address_columns = [ address_columns = %w(
"city", city
"street", street
"zip", zip
"created_at", created_at
"street2", street2
"street3", street3
"creator_str", creator_str
"updator_str", updator_str
"country_code", country_code
"state", state
"legacy_contact_id" legacy_contact_id
] )
contacts, addresses = [], [] contacts, addresses = [], []
existing_contact_ids = Contact.pluck(:legacy_id) existing_contact_ids = Contact.pluck(:legacy_id)
user = "rake-#{`whoami`.strip} #{ARGV.join ' '}" user = "rake-#{`whoami`.strip} #{ARGV.join ' '}"
count = 0 count = 0
Legacy::Contact.includes(:object_registry, :object, :object_registry => :registrar).find_each(batch_size: 10000).with_index do |x, index| Legacy::Contact.includes(:object_registry, :object, object_registry: :registrar)
.find_each(batch_size: 10000).with_index do |x, index|
next if existing_contact_ids.include?(x.id) next if existing_contact_ids.include?(x.id)
count += 1 count += 1
@ -164,60 +166,60 @@ namespace :import do
start = Time.now.to_f start = Time.now.to_f
puts '-----> Importing domains...' puts '-----> Importing domains...'
domain_columns = [ domain_columns = %w(
"name", name
"registered_at", registered_at
"valid_from", valid_from
"valid_to", valid_to
"auth_info", auth_info
"created_at", created_at
"name_dirty", name_dirty
"name_puny", name_puny
"period", period
"period_unit", period_unit
"creator_str", creator_str
"updator_str", updator_str
"legacy_id", legacy_id
"legacy_registrar_id", legacy_registrar_id
"legacy_registrant_id" legacy_registrant_id
] )
domain_contact_columns = [ domain_contact_columns = %w(
"contact_type", contact_type
"creator_str", creator_str
"updator_str", updator_str
"legacy_domain_id", legacy_domain_id
"legacy_contact_id" legacy_contact_id
] )
domain_status_columns = [ domain_status_columns = %w(
"description", description
"value", value
"creator_str", creator_str
"updator_str", updator_str
"legacy_domain_id" legacy_domain_id
] )
nameserver_columns = [ nameserver_columns = %w(
"hostname", hostname
"ipv4", ipv4
"ipv6", ipv6
"creator_str", creator_str
"updator_str", updator_str
"legacy_domain_id" legacy_domain_id
] )
dnskey_columns = [ dnskey_columns = %w(
"flags", flags
"protocol", protocol
"alg", alg
"public_key", public_key
"ds_alg", ds_alg
"ds_digest_type", ds_digest_type
"creator_str", creator_str
"updator_str", updator_str
"legacy_domain_id" legacy_domain_id
] )
domains, nameservers, dnskeys, domain_statuses, domain_contacts = [], [], [], [], [] domains, nameservers, dnskeys, domain_statuses, domain_contacts = [], [], [], [], []
existing_domain_ids = Domain.pluck(:legacy_id) existing_domain_ids = Domain.pluck(:legacy_id)
@ -231,7 +233,7 @@ namespace :import do
:object_states, :object_states,
:dnskeys, :dnskeys,
:domain_contact_maps, :domain_contact_maps,
:nsset => {:hosts => :host_ipaddr_maps} nsset: { hosts: :host_ipaddr_maps }
).find_each(batch_size: 10000).with_index do |x, index| ).find_each(batch_size: 10000).with_index do |x, index|
next if existing_domain_ids.include?(x.id) next if existing_domain_ids.include?(x.id)
count += 1 count += 1