Class: Ace::TestRunner::Suite::DisplayManager
- Inherits:
-
Object
- Object
- Ace::TestRunner::Suite::DisplayManager
- Includes:
- DisplayHelpers
- Defined in:
- lib/ace/test_runner/suite/display_manager.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Instance Method Summary collapse
-
#finalize_display ⇒ Object
(also: #show_final_results)
Finalize display by moving cursor past the display area.
-
#initialize(packages, config) ⇒ DisplayManager
constructor
A new instance of DisplayManager.
- #initialize_display ⇒ Object
- #refresh ⇒ Object
-
#show_summary(summary) ⇒ Object
Display the summary section using shared helpers.
- #update_package(package, status, output = nil) ⇒ Object
Methods included from DisplayHelpers
Constructor Details
#initialize(packages, config) ⇒ DisplayManager
Returns a new instance of DisplayManager.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 13 def initialize(packages, config) @packages = packages @config = config @lines = {} @package_status = {} @start_time = Time.now @use_color = config.dig("test_suite", "display", "color") != false @last_refresh = Time.now @refresh_interval = config.dig("test_suite", "display", "update_interval") || 0.1 end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 11 def config @config end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
11 12 13 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 11 def lines @lines end |
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
11 12 13 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 11 def packages @packages end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
11 12 13 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 11 def start_time @start_time end |
Instance Method Details
#finalize_display ⇒ Object Also known as: show_final_results
Finalize display by moving cursor past the display area. In progress mode, package results are already shown inline during updates, so we skip redrawing the results table. The overall summary is handled by show_summary.
67 68 69 70 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 67 def finalize_display move_to_line(@footer_line + 1) puts end |
#initialize_display ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 24 def initialize_display # Clear screen like Ctrl+L (preserves scrollback) print "\033[H\033[J" # Print header puts separator puts " ACE Test Suite Runner - Running #{@packages.size} packages" puts separator puts # Reserve lines for each package @packages.each_with_index do |package, index| @lines[package["name"]] = index + 5 # Account for header lines @package_status[package["name"]] = {status: :waiting} print_package_line(package["name"]) end # Print footer space puts puts @footer_line = @lines.values.max + 3 end |
#refresh ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 53 def refresh # Only refresh if enough time has passed return if Time.now - @last_refresh < @refresh_interval @package_status.each do |name, _status| print_package_line(name) end @last_refresh = Time.now end |
#show_summary(summary) ⇒ Object
Display the summary section using shared helpers
76 77 78 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 76 def show_summary(summary) render_summary(summary, @start_time, separator) end |
#update_package(package, status, output = nil) ⇒ Object
47 48 49 50 51 |
# File 'lib/ace/test_runner/suite/display_manager.rb', line 47 def update_package(package, status, output = nil) @package_status[package["name"]] = status print_package_line(package["name"]) end |