27: def self.generate_header(global, config)
28: return "" if global.quiet
29: header = StringIO.new
30: title, name = "RUDY v#{Rudy::VERSION}", config.accounts.aws.name
31: now_utc = Time.now.utc.strftime("%Y-%m-%d %H:%M:%S")
32: criteria = []
33: [:region, :zone, :environment, :role, :position].each do |n|
34: key, val = n.to_s.slice(0,1).att, global.send(n)
35: key = 'R' if n == :region
36: next unless val
37: criteria << "#{key.att}:#{val.to_s.bright}"
38: end
39: if config.accounts && config.accounts.aws
40: if global.verbose > 0
41: header.puts '%s -- %s -- %s UTC' % [title, name, now_utc]
42: end
43: header.puts '[%s]' % [criteria.join(" ")], $/
44: end
45: header.rewind
46: header.read
47: end