diff options
| author | Zog | 2018-02-21 07:29:40 +0100 |
|---|---|---|
| committer | Zog | 2018-02-21 16:18:34 +0100 |
| commit | a357c68cc96c642f15991a85e3982f4553c32a22 (patch) | |
| tree | cd2c30966891c4f1a24954a77d6ebcb73562faf2 | |
| parent | 9ef7a5d9a91c82f6960592e4c8d9cc777a688830 (diff) | |
| download | chouette-core-a357c68cc96c642f15991a85e3982f4553c32a22.tar.bz2 | |
Improve output of importers
| -rw-r--r-- | app/models/simple_importer.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/simple_importer.rb b/app/models/simple_importer.rb index b824d596d..aacf85a9e 100644 --- a/app/models/simple_importer.rb +++ b/app/models/simple_importer.rb @@ -262,7 +262,7 @@ class SimpleImporter < ActiveRecord::Base msg += "\n\n" msg += colorize "=== MESSAGES (#{@messages.count}) ===\n", :green msg += "[...]\n" if @messages.count > lines_count - msg += @messages.last(lines_count).join("\n") + msg += @messages.last(lines_count).map{|m| m.truncate(@status_width)}.join("\n") msg += "\n"*[lines_count-@messages.count, 0].max end @@ -273,7 +273,9 @@ class SimpleImporter < ActiveRecord::Base msg += @errors.last(lines_count).map do |j| kind = j[:kind] kind = colorize(kind, kind == :error ? :red : :orange) - encode_string "[#{kind}]\t\tL#{j[:line]}\t#{j[:error]}\t\t#{j[:message]}" + kind = "[#{kind}]" + kind += " "*(25 - kind.size) + encode_string("#{kind}L#{j[:line]}\t#{j[:error]}\t\t#{j[:message]}").truncate(@status_width) end.join("\n") end custom_print msg, clear: true |
