Skip to content

Commit 39dd62c

Browse files
committed
Display a progress bar
Some of these tasks may take a while, the ruby progress bar library makes it easy to get a sense of progress. I've not shown the progress bar in tests as it messes the test output.
1 parent 607c38c commit 39dd62c

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ gem 'puma', '~> 7.2'
4242
gem 'rack_content_type_default', '~> 1.1'
4343
gem 'rack-cors'
4444
gem 'rails', '~> 7.1'
45+
gem 'ruby-progressbar', '~> 1.13', require: false
4546
gem 'sentry-rails'
4647
gem 'statesman'
4748

Gemfile.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ DEPENDENCIES
635635
rubocop-rspec_rails
636636
ruby-lsp
637637
ruby-lsp-rspec (~> 0.1.29)
638+
ruby-progressbar (~> 1.13)
638639
selenium-webdriver
639640
sentry-rails
640641
shoulda-matchers (~> 7.0)

lib/scratch_asset_importer.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def initialize(asset_names, asset_base_url)
1717
end
1818

1919
def import
20+
bar = ProgressBar.create(format: '%t: |%B| %c of %C %E', total: asset_names.count) if show_progress?
21+
2022
asset_names.each do |asset_name|
23+
bar.increment if show_progress?
2124
import_asset(asset_name)
2225
end
2326
end

0 commit comments

Comments
 (0)