fastlane-community / fastlane-ftp-plugin

Ftp plugin for Fastlane

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changing "progress bar" for continuous integration

JohanVase opened this issue · comments

Thanks for a great plugin. I would like to request an update (I will make a pull request):

The progress bar has a big downside when using continuous integration (or when capturing log output in general). Then it prints a newline for each progress bar update, for example:

  0 %[>                              ]
  0 %[>                              ]
  0 %[>                              ]
....
  6 %[=>                             ]
  6 %[=>                             ]
  6 %[=>                             ]
  6 %[==>                            ]
  6 %[==>                            ]
  7 %[==>                            ]
  7 %[==>                            ]
....

I would like to make it possible to get a 'simpler' output to avoid bloating the log. It could for example be activated via a new parameter to the ftp action.

My suggestion is to append to the same line until the file has transferred. The output could be like this:

//after 50% upload, it will look like:
0%       25%       50%       75%        100%
|         |         |         |          |
[====================

//after 100% upload, it will look like:
0%       25%       50%       75%        100%
|         |         |         |          |
[========================================] 

(of course this only works for monospace-fonts)

The code will be something like this:

//This is test code - should be adopted to be used in the closure
transferred = 0
print "\n"
print "0%       25%       50%       75%        100%\n"
print "|         |         |         |          |\n"
print "["
chars_printed = 0
while transferred < filesize
  sleep(0.3)
  transferred += data.size
  finished = ((transferred.to_f / filesize.to_f) * 40).to_i
  (finished-1).downto(chars_printed) { |n| print "="; chars_printed+=1 }
end
print "]\n"

Fix with 1.5.0