Sha256: db4489f72d28ee94fa531c56fe67b3ab06f442e5c5f96aed268546f560356ae8
Contents?: true
Size: 813 Bytes
Versions: 8
Compression:
Stored size: 813 Bytes
Contents
require 'guignol/commands/base' Guignol::Shell.class_eval do desc 'list [PATTERNS]', 'List the status of all known instances' def list(*patterns) patterns.push('.*') if patterns.empty? Guignol::Commands::List.new(patterns).run end end module Guignol::Commands class List < Base private def run_on_server(instance, options = {}) synchronize do shell.say instance.name.ljust(@max_width + 1) shell.say instance.state, colorize(instance.state) end end def before_run(configs, options = {}) @max_width = configs.keys.map(&:size).max end def colorize(state) case state when 'running' then :green when /starting|stopping/ then :yellow when 'nonexistent' then :red end end end end
Version data entries
8 entries across 8 versions & 1 rubygems