Sha256: a3017bf3aa132527d8a489f9dea3076519473edf8bbf210020672c7ff3baf7b3

Contents?: true

Size: 628 Bytes

Versions: 12

Compression:

Stored size: 628 Bytes

Contents

require 'guignol/commands/base'
require 'guignol/models/instance'

Guignol::Shell.class_eval do
  desc 'dns [PATTERNS]', 'Prints the DNS mappings for servers matching PATTERNS'
  def dns(*patterns)
    patterns.push('.*') if patterns.empty?
    Guignol::Commands::DNS.new(patterns).run
  end
end


module Guignol::Commands
  class DNS < Base
    def run_on_server(instance, options = {})
      synchronize do
        shell.say instance.name.ljust(@max_width + 1)
        shell.say instance.dns_name
      end
    end

    def before_run(configs, options = {})
      @max_width = configs.keys.map(&:size).max
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
guignol-0.3.16 lib/guignol/commands/dns.rb
guignol-0.3.15 lib/guignol/commands/dns.rb
guignol-0.3.14 lib/guignol/commands/dns.rb
guignol-0.3.13 lib/guignol/commands/dns.rb
guignol-0.3.12 lib/guignol/commands/dns.rb
guignol-0.3.10 lib/guignol/commands/dns.rb
guignol-0.3.9 lib/guignol/commands/dns.rb
guignol-0.3.8 lib/guignol/commands/dns.rb
guignol-0.3.7 lib/guignol/commands/dns.rb
guignol-0.3.6.2 lib/guignol/commands/dns.rb
guignol-0.3.6.1 lib/guignol/commands/dns.rb
guignol-0.3.6 lib/guignol/commands/dns.rb