public
Description: simple backup for mysql, posgresql, svn and files to s3 or local filesystem
Homepage: http://blog.astrails.com/astrails-safe
Clone URL: git://github.com/astrails/safe.git
Vitaly Kushner (author)
Tue Oct 20 09:25:54 -0700 2009
safe / .autotest
100644 43 lines (33 sloc) 1.097 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'autotest'
 
Autotest.add_hook :initialize do |at|
  at.clear_mappings
  at.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m
  at.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
 
  at.add_mapping(%r%^examples/.*_example.rb$%) { |filename, _|
    filename
  }
 
  at.add_mapping(%r%^lib/(.*)\.rb$%) { |filename, m|
    ["examples/lib/#{m[1]}_example.rb"]
  }
 
  at.add_mapping(%r%^examples/(example_helper|shared/.*)\.rb$%) {
    at.files_matching %r%^examples/.*_example\.rb$%
  }
end
 
class MicronautCommandError < StandardError; end
 
class Autotest::Micronaut < Autotest
  #remove_method :consolidate_failures, :make_test_cmd
  #remove_method :make_test_cmd
 
  def consolidate_failures(failed)
    filters = new_hash_of_arrays
    failed.each do |spec, trace|
      if trace =~ /\n(\.\/)?(.*example\.rb):[\d]+:\Z?/
        filters[$2] << spec
      end
    end
    return filters
  end
 
  def make_test_cmd(files_to_test)
    return '' if files_to_test.size == 0
    "bin/micronaut #{files_to_test.keys.sort.join(' ')}"
  end
 
end