module RubyQA class Manager attr_reader :resources, :hosts @@tests = Array.new @@hosts = Array.new def self.tests @@tests end def self.hosts @@hosts end def self.add_host(host) @@hosts << host register_resources(host) update_resources(host) end def self.register_resources (host) Resource.all_resources.each do |resource| host.add_resource(resource) end end def self.update_resources (host) host.update_resources end def self.new_test(name, options={}, &test_proc) @@tests << Test.new(name, **options, &test_proc) end def self.run_tests @@hosts.each do |host| tests = @@tests.select{|test| test.valid_host(host)} tests.each do |test| test.run(host) end end end def self.report (template = nil) if template puts template.result(binding) else puts @@tests.map(&:report).join("\n") end end end end