def write_db
      new_db = {}
      @db.keys.sort.each do |key|
        new_db[key] = {}
        Braid::Mirror::ATTRIBUTES.each do |k|
          new_db[key][k] = @db[key][k] if @db[key].has_key?(k)
        end
      end
      new_data = {
        'config_version' => CURRENT_CONFIG_VERSION,
        'mirrors' => new_db
      }
      File.open(@config_file, 'wb') do |f|
        f.write JSON.pretty_generate(new_data)
        f.write "\n"
      end
    end
def write_db
      new_db = {}
      @db.keys.sort.each do |key|
        new_db[key] = {}
        Braid::Mirror::ATTRIBUTES.each do |k|
          new_db[key][k] = @db[key][k] if @db[key].has_key?(k)
        end
      end
      new_data = {
        'config_version' => CURRENT_CONFIG_VERSION,
        'mirrors' => new_db
      }
      File.open(@config_file, 'wb') do |f|
        f.write JSON.pretty_generate(new_data)
        f.write "\n"
      end
    end
Public for upgrade-config command only.