Class: Server

Inherits:
Sinatra::Base show all
Defined in:
lib/server.rb

Defined Under Namespace

Modules: Helpers

Instance Method Summary collapse

Instance Method Details

#all_descriptionsObject



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/server.rb', line 165

def all_descriptions
  check_session_for_error
  descriptions = settings.system_description_store.list
  @all_descriptions = Hash.new

  descriptions.each do |name|
    scopes = []
    begin
      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 Machinery::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
end