def ordered_by_deps(apps, processed = Set[])
      ordered = []
      apps.each do |tag, info|
        next if processed.include?(tag)

        if deps = Array(info["depends-on"])
          dep_apps = {}
          deps.each do |dep|
            dep_apps[dep] = apps[dep]
          end

          processed.add(tag)

          ordered += ordered_by_deps(dep_apps, processed)
          ordered << info
        else
          ordered << info
          processed.add(tag)
        end
      end

      ordered.each { |app| app.delete("depends-on") }

      ordered
    end
def ordered_by_deps(apps, processed = Set[])
      ordered = []
      apps.each do |tag, info|
        next if processed.include?(tag)

        if deps = Array(info["depends-on"])
          dep_apps = {}
          deps.each do |dep|
            dep_apps[dep] = apps[dep]
          end

          processed.add(tag)

          ordered += ordered_by_deps(dep_apps, processed)
          ordered << info
        else
          ordered << info
          processed.add(tag)
        end
      end

      ordered.each { |app| app.delete("depends-on") }

      ordered
    end
sort applications in dependency order
 e.g. if A depends on B, B will be listed before A