mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 00:33:23 -05:00
BikeCsvImporter: colorize importer output to highlight individual row statuses
This commit is contained in:
parent
072f303c65
commit
ae79a34652
1
Gemfile
1
Gemfile
@ -35,6 +35,7 @@ group :development, :test do
|
||||
gem 'factory_girl_rails', '~> 1.2'
|
||||
gem 'pry', '~> 0.9.8'
|
||||
gem 'faker', '~> 1.2.0'
|
||||
gem 'colorize'
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
@ -69,6 +69,7 @@ GEM
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.10.0)
|
||||
colorize (0.8.1)
|
||||
database_cleaner (1.2.0)
|
||||
decent_exposure (1.0.2)
|
||||
devise (2.0.6)
|
||||
@ -255,6 +256,7 @@ DEPENDENCIES
|
||||
cancan
|
||||
capybara (~> 2.2.1)
|
||||
coffee-rails (~> 3.2.1)
|
||||
colorize
|
||||
database_cleaner (~> 1.2.0)
|
||||
decent_exposure (~> 1.0.1)
|
||||
devise (~> 2.0.4)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user