class Autotest
def initialize options
def initialize options # these two are set directly because they're wrapped with # add/remove/clear accessor methods @exception_list = [] @child = nil self.options = options self.extra_class_map = {} self.extra_files = [] self.failures = Hash.new { |h,k| h[k] = Hash.new { |h2,k2| h2[k2] = [] } } self.files_to_test = new_hash_of_arrays reset_find_order self.libs = %w[. lib test].join(File::PATH_SEPARATOR) self.output = $stderr self.prefix = nil self.sleep = 1 self.test_mappings = [] self.test_prefix = "gem 'minitest'" self.testlib = "minitest/autorun" # TODO: rename self.find_directories = ['.'] # file in /lib -> run test in /test self.add_mapping(/^lib\/.*\.rb$/) do |filename, _| possible = File.basename(filename).gsub '_', '_?' files_matching %r%^test/.*#{possible}$% end # file in /test -> run it (ruby & rails styles) self.add_mapping(/^test.*\/(test_.*|.*_test)\.rb$/) do |filename, _| filename end default_configs = [File.expand_path('~/.autotest'), './.autotest'] configs = options[:rc] || default_configs configs.each do |f| load f if File.exist? f end end