Fix Rubocop issues
This commit is contained in:
parent
a45008640f
commit
7f5d06b23c
27 changed files with 94 additions and 83 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue