33: def config
34:
35:
36:
37:
38:
39: if @@config.nil? || @@config.empty?
40: return if @@global.quiet
41: raise Rudy::NoConfig
42: end
43:
44: outform = @@global.format == :json ? :to_json : :to_yaml
45:
46: types = @option.marshal_dump.keys & @@config.keys
47: types = @@config.keys if @option.all
48: types = [:machines] if types.empty?
49:
50: if @option.project
51: rf = File.join(RUDY_HOME, 'Rudyfile')
52: raise "Cannot find: #{rf}" unless File.exists?(rf)
53: li File.read(rf)
54:
55: elsif @option.script
56: conf = fetch_script_config
57: li conf.to_hash.send(outform) if conf
58:
59: else
60:
61: types.each do |conftype|
62: li "# #{conftype.to_s.upcase}"
63: next unless @@config[conftype]
64: if conftype == :accounts
65: skey = @@config[conftype][:aws][:secretkey]
66: @@config[conftype][:aws][:secretkey] = hide_secret_key(skey)
67: end
68:
69: li @@config[conftype].to_hash.send(outform)
70: end
71: end
72:
73: end