Fix Rubocop issues

This commit is contained in:
CactusPuppy 2021-02-18 21:03:28 -08:00
parent a45008640f
commit 7f5d06b23c
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
27 changed files with 94 additions and 83 deletions

View file

@ -13,24 +13,24 @@ namespace :db do
end
end
desc "Import a given file into the database"
desc 'Import a given file into the database'
task :import, [:path] => :environment do |_t, args|
dump_path = args.path
connection_config = ActiveRecord::Base.connection_config
case connection_config[:adapter]
when "postgresql"
when 'postgresql'
system("PGPASSWORD=#{connection_config[:password]} pg_restore " \
"--verbose --clean --no-acl --no-owner " \
'--verbose --clean --no-acl --no-owner ' \
"--username=#{connection_config[:username]} " \
"-d #{connection_config[:database]} #{dump_path}")
when "mysql", "mysql2"
when 'mysql', 'mysql2'
system("mysql -u #{connection_config[:username]} " \
"-p#{connection_config[:password]} " \
"#{connection_config[:database]} < #{dump_path}")
else
raise NotImplementedError, "An importer hasn't been implemented for: " \
"#{connection_config[:adapter]}"
raise NotImplementedError.new("An importer hasn't been implemented for: " \
"#{connection_config[:adapter]}")
end
end
end