BikeCsvImporter: colorize importer output to highlight individual row statuses

This commit is contained in:
Ilya Konanykhin
2017-03-20 21:44:27 +06:00
parent 072f303c65
commit ae79a34652
3 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -30,10 +30,10 @@ class BikeCsvImporter
bike = new_bike bike_hash
check_method = dry_run ? :valid? : :save
if bike.try check_method
puts "Imported #{bike.shop_id}: #{bike}"
puts "Imported #{bike.shop_id}: #{bike}".green
imported_count += 1
else
puts "Skipped #{bike.try(:shop_id) || bike_hash.values.first}: #{bike.try(:errors).try(:full_messages).try :join, '; '}"
puts "Skipped #{bike.try(:shop_id) || bike_hash.values.first}: #{bike.try(:errors).try(:full_messages).try :join, '; '}".red
skipped_count += 1
end
end