ConsoleProgressBar
You can use this gem on rake tasks, migrations or irb scripts for watching to transaction progress
Installation
Add this line to your application's Gemfile:
gem 'console_progress_bar'
And then execute:
$ bundle
Or install it yourself as:
$ gem install console_progress_bar
Usage
For counter usage:
= ConsoleProgressBar::ProgressBar.new
counter = .counter
100.times do
sleep(0.1)
counter.increase
end
# advanced usage of counter object
# total parameter is counts of your total transactions
# you can show elapsed time by setting with_elapsed_time parameter to true
# you can show calculated time remaining by setting with_remaining_time parameter to true
# increament_size parameter sets to increament size
counter = .counter(:total => 100, :with_elapsed_time => true, :with_remaining_time => true, :increament_size => 5)
For animation usage:
= ConsoleProgressBar::ProgressBar.new
animator = .animator
100.times do
sleep(0.1)
animator.animate
end
# advanced usage of animator object
# total parameter is counts of your total transactions
# you can show elapsed time by setting with_elapsed_time parameter to true
# you can show calculated time remaining by setting with_remaining_time parameter to true
# increament_size parameter sets to increament size
animator = .animator(:total => 100, :with_elapsed_time => true, :with_remaining_time => true, :increament_size => 5)
For progressbar usage:
= ConsoleProgressBar::ProgressBar.new
= .
100.times do
sleep(0.1)
.draw
end
# advanced usage of bar object
# total parameter is counts of your total transactions
# you can show elapsed time by setting with_elapsed_time parameter to true
# you can show calculated time remaining by setting with_remaining_time parameter to true
# increament_size parameter sets to increament size
# width parameter is width of shown progress bar
= .(:total => 100, :with_elapsed_time => true, :with_remaining_time => true, :increament_size => 5, :width => 40)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request