lib/server.rb in machinery-tool-1.16.2 vs lib/server.rb in machinery-tool-1.16.3

- old
+ new

@@ -1,5 +1,6 @@ +# -*- coding: utf-8 -*- # Copyright (c) 2013-2015 SUSE LLC # # This program is free software; you can redistribute it and/or # modify it under the terms of version 3 of the GNU General Public License as # published by the Free Software Foundation. @@ -210,9 +211,44 @@ content_type type attachment File.basename(filename) content + end + + get "/" do + descriptions = settings.system_description_store.list + @all_descriptions = Hash.new + + descriptions.each do |name| + scopes = [] + begin + system_description = SystemDescription.load( + name, settings.system_description_store, skip_validation: true + ) + @all_descriptions[name] = Hash.new + @all_descriptions[name]["date"] = system_description.latest_update + @all_descriptions[name]["host"] = system_description.host + system_description.scopes.each do |scope| + entry = Machinery::Ui.internal_scope_list_to_string(scope) + if SystemDescription::EXTRACTABLE_SCOPES.include?(scope) + if system_description.scope_extracted?(scope) + entry += " (extracted)" + else + entry += " (not extracted)" + end + end + scopes << entry + end + @all_descriptions[name]["scopes"] = scopes + rescue Machinery::Errors::SystemDescriptionIncompatible, + Machinery::Errors::SystemDescriptionError => e + @errors ||= Array.new + @errors.push(e) + end + end + + haml File.read(File.join(Machinery::ROOT, "html/landing_page.html.haml")) end get "/compare/:a/:b" do @description_a = SystemDescription.load(params[:a], settings.system_description_store) @description_b = SystemDescription.load(params[:b], settings.system_description_store)