-
Notifications
You must be signed in to change notification settings - Fork 39
/
.autotest
70 lines (59 loc) · 1.9 KB
/
.autotest
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
path = File.expand_path(File.dirname(__FILE__))
modules = []
files = ARGV
files = nil if files.length == 0
if ENV['COMPONENT']
modules = ENV['COMPONENT'].split(",")
elsif ENV['NO_COMPONENTS']
modules = []
else
Dir.glob("#{path}/vendor/modules/[a-z0-9_]*") do |file|
if file =~ /\/([a-z_0-9-]+)\/{0,1}$/
modules << $1
end
end
end
Autotest.add_hook :initialize do |at|
%w{.hg .git tmtags Rakefile Capfile README spec/spec.opts spec/rcov.opts}.each {|exception|at.add_exception(exception)}
if ENV['COMPONENT'] || files
at.clear_mappings()
end
at.add_exception("public/")
at.remove_exception("log/") # f-ing blog
at.add_exception("log/*.log")
at.add_exception("log.log")
at.add_exception("*.log")
at.add_exception("*.pid")
at.add_exception("backup/")
at.add_exception('log/test.log')
if files
files.each do |file|
at.add_mapping %r%^#{file}$% do |filename,matches|
if file =~ /^(lib|app)\/(.*)\.rb$/
partfile = $2
if $1 == 'lib'
partfile = "lib/" + partfile
end
at.files_matching( %r%^spec/#{partfile}_spec.rb$% )
end
end
end
else
modules.each do |mod|
%w(controllers models views lib).each do |type|
at.add_mapping %r%^vendor/modules/#{mod}/app/#{type}/(.*)\.rb$% do |filename,matches|
at.files_matching(/^vendor\/modules\/#{mod}\/spec\/#{type}\/#{matches[1]}_spec.rb$/)
end
at.add_mapping %r%^vendor/modules/#{mod}/spec/#{type}/(.*)_spec\.rb$% do |filename,matches|
at.files_matching(/^vendor\/modules\/#{mod}\/spec\/#{type}\/#{matches[1]}_spec.rb$/)
end
end
end
end
end
#Autotest.add_hook :initialize do |at|
# at.add_mapping(%r%^acts_as_currency/lib/.*\.rb$%) {
# at.files_matching %r%^spec/models/product_spec\.rb$% +
# at.files_matching %r%^plugins/acts_as_currency/spec/.*_spec\.rb$%
# }
#end