-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19c86bd
commit 286bab3
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
lib/capistrano_multiconfig_parallel/celluloid/bundler_terminal_table.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module CapistranoMulticonfigParallel | ||
class BundlerTerminalTable < CapistranoMulticonfigParallel::TerminalTable | ||
|
||
def self.topic | ||
'bundler_terminal' | ||
end | ||
|
||
def default_heaadings | ||
['Job UUID', 'App', 'Action', 'Current Status'] | ||
end | ||
|
||
def run | ||
subscribe(CapistranoMulticonfigParallel::BundlerTerminalTable.topic, :notify_bundler_install_status) | ||
end | ||
|
||
def notify_bundler_install_status(_channel, _message) | ||
table = Terminal::Table.new(title: 'Bundler Check Status Table', headings: default_heaadings) | ||
jobs = setup_table_jobs(table) | ||
display_table_on_terminal(table, jobs) | ||
end | ||
|
||
def fetch_table_size(jobs) | ||
job_rows = jobs.sum { |job, _bundler_worker| job.row_size } | ||
(job_rows + 2)**2 | ||
end | ||
|
||
|
||
def setup_table_jobs(table) | ||
jobs = managers_alive? ? @job_manager.bundler_workers_store.dup : [] | ||
jobs.each do |job, bundler_worker| | ||
table.add_row(job.bundler_check_terminal_row) | ||
table.add_separator if jobs.keys.last != job | ||
end | ||
jobs | ||
end | ||
|
||
def managers_alive? | ||
@job_manager.alive? | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters