Sha256: e84b8d6a6ee1d3586b926ab97320161f60152bd3a32fb10ef29213783191316c

Contents?: true

Size: 1.03 KB

Versions: 23

Compression:

Stored size: 1.03 KB

Contents

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

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
capistrano_multiconfig_parallel-2.0.6 lib/capistrano_multiconfig_parallel/celluloid/bundler_terminal_table.rb
capistrano_multiconfig_parallel-2.0.5 lib/capistrano_multiconfig_parallel/celluloid/bundler_terminal_table.rb
capistrano_multiconfig_parallel-2.0.4 lib/capistrano_multiconfig_parallel/celluloid/bundler_terminal_table.rb