This global class is used by all Huxtable objects. When a new CLI global is added, the appropriate field must be added to this class (optional: a default value in initialize).
# File lib/rudy/global.rb, line 50 def initialize postprocess # These attributes MUST have values. @verbose ||= 0 @nocolor = true unless @nocolor == "false" || @nocolor == false @quiet ||= false @parallel ||= false @force ||= false @format ||= :string # as in, to_s @print_header = true if @print_header == nil end
# File lib/rudy/global.rb, line 62 def apply_config(config) return unless config.is_a?(Rudy::Config) clear_system_defaults # temporarily unapply default values if config.defaults? # Apply the "color" default before "nocolor" so nocolor has presedence @nocolor = !config.defaults.color unless config.defaults.color.nil? # WARNING: Don't add user to this list. The global value should return # the value specified on the command line or nil. If it is nil, we can # check the value from the machines config. If that is nil, we use the # value from the defaults config. # WARNING: Don't add bucket either or any machines configuration param # TODO: investigate removing this apply_config method ]region zone environment role position bucket localhost nocolor quiet auto force parallel].each do |name| curval, defval = self.send(name), config.defaults.send(name) if curval.nil? && !defval.nil? # Don't use the accessors. These are defaults so no Region magic. self.instance_variable_set("@#{name}", defval) end end end if config.accounts? && config.accounts.aws ]accesskey secretkey accountnum cert pkey].each do |name| val = config.accounts.aws.send(name) self.send("#{name}=", val) unless val.nil? end end postprocess end
# File lib/rudy/global.rb, line 106 def region=(r) @region = r @zone = "#{@region}b".to_sym end
Generated with the Darkfish Rdoc Generator 2.