Skip to content

Commit 24df8b3

Browse files
committed
feat: ✨ added enable_progress_bar as a config option
1 parent b9f4c8f commit 24df8b3

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lib/omnibus/config.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,11 @@ def reset!
575575
# @return [Integer]
576576
default(:build_retries, 0)
577577

578+
# Display a progress bar during download.
579+
#
580+
# @return [true, false]
581+
default(:enable_progress_bar, true)
582+
578583
# Use the incremental build caching implemented via git. This will
579584
# drastically improve build times, but may result in hidden and
580585
# unexpected bugs.

lib/omnibus/download_helpers.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ def download_file!(from_url, to_path, download_options = {})
8080

8181
# Regular HTTP download using OpenURI
8282
# :enable_progress_bar is a special option we handle.
83-
# by default we enable the progress bar.
83+
# by default we enable the progress bar, see: ./config.rb
84+
# the options.delete is here to still handle the override from ./licensing.rb
8485
enable_progress_bar = options.delete(:enable_progress_bar)
85-
enable_progress_bar = true if enable_progress_bar.nil?
86+
enable_progress_bar = Config.enable_progress_bar if enable_progress_bar.nil?
8687

8788
# Safely extract download headers if they exist and ensure we send
8889
# Accept-Encoding => "identity" by default (tests and some proxies expect it)

spec/unit/config_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module Omnibus
4141
include_examples "a configurable", :solaris_linker_mapfile, "files/mapfiles/solaris"
4242
include_examples "a configurable", :append_timestamp, true
4343
include_examples "a configurable", :build_retries, 0
44+
include_examples "a configurable", :enable_progress_bar, true
4445
include_examples "a configurable", :use_git_caching, true
4546
include_examples "a configurable", :fetcher_read_timeout, 60
4647
include_examples "a configurable", :fetcher_retries, 5

0 commit comments

Comments
 (0)