lib/server.rb in machinery-tool-1.22.1 vs lib/server.rb in machinery-tool-1.22.2

- old
+ new

@@ -109,11 +109,12 @@ end changed.push( id: change[0][opts[:key]], change: "(" + changes.join(", ") + ")", - diffable: change[0].is_a?(UnmanagedFile) && change[0].is_a?(UnmanagedFile) && + diffable: change[0].is_a?(Machinery::UnmanagedFile) && + change[0].is_a?(Machinery::UnmanagedFile) && change[0].file? && change[1].file? && @diff[scope].try(:common).try(:attributes).try(:[], "extracted") ) end changed @@ -140,11 +141,11 @@ try: ["index.html"] enable :sessions get "/descriptions/:id/files/:scope/*" do - description = SystemDescription.load(params[:id], settings.system_description_store) + description = Machinery::SystemDescription.load(params[:id], settings.system_description_store) filename = File.join("/", params["splat"].first) file = description[params[:scope]].find { |f| f.name == filename } if request.accept.first.to_s == "text/plain" && file.binary? @@ -167,19 +168,19 @@ @all_descriptions = Hash.new descriptions.each do |name| scopes = [] begin - system_description = SystemDescription.load( + system_description = Machinery::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 Machinery::SystemDescription::EXTRACTABLE_SCOPES.include?(scope) if system_description.scope_extracted?(scope) entry += " (extracted)" else entry += " (not extracted)" end @@ -206,19 +207,23 @@ end get "/compare/:a/:b" do all_descriptions - @description_a = SystemDescription.load(params[:a], settings.system_description_store) - @description_b = SystemDescription.load(params[:b], settings.system_description_store) + @description_a = Machinery::SystemDescription.load( + params[:a], settings.system_description_store + ) + @description_b = Machinery::SystemDescription.load( + params[:b], settings.system_description_store + ) @meta = {} @diff = {} - Inspector.all_scopes.each do |scope| + Machinery::Inspector.all_scopes.each do |scope| if @description_a[scope] && @description_b[scope] - @diff[scope] = Comparison.compare_scope(@description_a, @description_b, scope) + @diff[scope] = Machinery::Comparison.compare_scope(@description_a, @description_b, scope) elsif @description_a[scope] || @description_b[scope] @meta[:uninspected] ||= Hash.new unless @description_a[scope] @meta[:uninspected][@description_a.name] ||= Array.new @@ -233,16 +238,16 @@ haml File.read(File.join(Machinery::ROOT, "html/comparison.html.haml")) end get "/compare/:a/:b/files/:scope/*" do - description1 = SystemDescription.load(params[:a], settings.system_description_store) - description2 = SystemDescription.load(params[:b], settings.system_description_store) + description1 = Machinery::SystemDescription.load(params[:a], settings.system_description_store) + description2 = Machinery::SystemDescription.load(params[:b], settings.system_description_store) filename = File.join("/", params["splat"].first) begin - diff = FileDiff.diff(description1, description2, params[:scope], filename) + diff = Machinery::FileDiff.diff(description1, description2, params[:scope], filename) rescue Machinery::Errors::BinaryDiffError status 406 return "binary file" end @@ -251,10 +256,12 @@ get "/:id" do all_descriptions begin - @description = SystemDescription.load(params[:id], settings.system_description_store) + @description = Machinery::SystemDescription.load( + params[:id], settings.system_description_store + ) rescue Machinery::Errors::SystemDescriptionNotFound => e session[:error] = e.to_s redirect "/" rescue Machinery::Errors::SystemDescriptionIncompatible, \ Machinery::Errors::SystemDescriptionError => e