lib/origen/site_config.rb
# Inspects the config(s) at the incex given.
Inspects the config(s) at the incex given.
Inspects the config ( s ) at the incex given .
def inspect_configs(*config_indexes)
      config_indexes.each do |i|
        if i.to_i > configs.size
          puts red("Origen::SiteConfig: index #{i} is out of range of the available configs! Total configs: #{configs.size}.")
        elsif i.to_i < 0
          puts red("Origen::SiteConfig: index #{i} is less than 0. This index is ignored.")
        else
          c = configs[i.to_i]
          puts "Inspecting config \##{i}"
          puts "Type: #{c.type}"
          puts "Path: #{c.path}"
          if c.centralized?
            puts "Cached At: #{c.cache_file}" if c.cache_file
            puts "Cached On: #{c.cache_file.ctime}" if c.cache_file
          end
          puts
          puts 'Values from this config:'
          spacing = ' ' * 2
          c.values.each do |var, val|
            if val.is_a?(Array)
              puts "#{var}: ["
              val.each { |v| puts "#{spacing} #{v}" }
              puts ']'
            elsif val.is_a?(Hash)
              puts "#{var}: {"
              val.each { |v| puts "#{spacing} #{v}" }
              puts '}'
            else
              puts "#{var}: #{val}"
            end
          end
          puts
          puts 'Active (highest-level) values from this config:'
          spacing = ' ' * 2
          vars_by_config.select { |k, v| v == c }.map { |k, v| [k, v[k]] }.to_h.each do |var, val|
            if val.is_a?(Array)
              puts "#{var}: ["
              val.each { |v| puts "#{spacing} #{v}" }
              puts ']'
            elsif val.is_a?(Hash)
              puts "#{var}: {"
              val.each { |v| puts "#{spacing} #{v}" }
              puts '}'
            else
              puts "#{var}: #{val}"
            end
          end
          puts
        end
      end
    end
def inspect_configs ( * config_indexes ) config_indexes . each do | i | if i . to_i > configs . size puts red ( "Origen::SiteConfig: index #{i} is out of range of the available configs! Total configs: #{configs.size}." ) elsif i . to_i < 0 puts red ( "Origen::SiteConfig: index #{i} is less than 0. This index is ignored." ) else c = configs [ i . to_i ] puts "Inspecting config \##{i}" puts "Type: #{c.type}" puts "Path: #{c.path}" if c . centralized? puts "Cached At: #{c.cache_file}" if c . cache_file puts "Cached On: #{c.cache_file.ctime}" if c . cache_file end puts puts 'Values from this config:' spacing = ' ' * 2 c . values . each do | var , val | if val . is_a? ( Array ) puts "#{var}: [" val . each { | v | puts "#{spacing} #{v}" } puts ']' elsif val . is_a? ( Hash ) puts "#{var}: {" val . each { | v | puts "#{spacing} #{v}" } puts '}' else puts "#{var}: #{val}" end end puts puts 'Active (highest-level) values from this config:' spacing = ' ' * 2 vars_by_config . select { | k , v | v == c } . map { | k , v | [ k , v [ k ] ] } . to_h . each do | var , val | if val . is_a? ( Array ) puts "#{var}: [" val . each { | v | puts "#{spacing} #{v}" } puts ']' elsif val . is_a? ( Hash ) puts "#{var}: {" val . each { | v | puts "#{spacing} #{v}" } puts '}' else puts "#{var}: #{val}" end end puts end end end
Inspects the config(s) at the incex given.
Inspects the config ( s ) at the incex given .
# Add a safeguard in case something happened being bootup and now and the cache is no longer present
config_indexes
<not_specific>