Module: Rudy::CLI

Defined in:
lib/rudy/cli.rb,
lib/rudy/cli/candy.rb,
lib/rudy/cli/disks.rb,
lib/rudy/cli/config.rb,
lib/rudy/cli/machines.rb,
lib/rudy/cli/routines.rb,
lib/rudy/cli/aws/s3/store.rb,
lib/rudy/cli/aws/ec2/candy.rb,
lib/rudy/cli/aws/ec2/zones.rb,
lib/rudy/cli/aws/ec2/groups.rb,
lib/rudy/cli/aws/ec2/images.rb,
lib/rudy/cli/aws/s3/buckets.rb,
lib/rudy/cli/aws/ec2/volumes.rb,
lib/rudy/cli/aws/sdb/domains.rb,
lib/rudy/cli/aws/ec2/keypairs.rb,
lib/rudy/cli/aws/ec2/addresses.rb,
lib/rudy/cli/aws/ec2/instances.rb,
lib/rudy/cli/aws/ec2/snapshots.rb

Overview

CLI

These classes provide the functionality for the Command line interfaces. See the bin/ files if you’re interested.

Defined Under Namespace

Modules: AWS Classes: Base, Candy, CommandBase, Config, Disks, Machines, NoCred, Output, Routines

Class Method Summary collapse

Class Method Details

.generate_header(global, config) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/rudy/cli.rb', line 113

def self.generate_header(global, config)
  return "" if global.quiet
  header = StringIO.new
  title, name = "RUDY v#{Rudy::VERSION}", config.accounts.aws.name
  now_utc = Time.now.utc.strftime("%Y-%m-%d %H:%M:%S")
  criteria = []
  [:region, :zone, :environment, :role, :position].each do |n|
    key, val = n.to_s.slice(0,1).att, global.send(n) 
    key = 'R' if n == :region
    next unless val
    criteria << "#{key.att}:#{val.to_s.bright}"
  end
  if config.accounts && config.accounts.aws
    if global.verbose > 0
      header.puts '%s -- %s -- %s UTC' % [title, name, now_utc]
    end
    header.puts '[%s]' % [criteria.join("  ")], $/
  end
  header.rewind
  header.read
end