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
|
# File 'lib/cucumber_in_groups.rb', line 14
def grouped_features(*args)
args << "features" if args.empty?
if ENV["GROUP"]
if ENV["GROUP"] =~ /^(\d+)of(\d+)$/
group = $1.to_i
groups_count = $2.to_i
if group > 0 and group <= groups_count
features = list_features(args).sort
files_to_test = features.in_groups(groups_count, false)[group-1]
if ENV['DEBUG']
STDERR.puts "\n=========== FEATURES GROUP #{group} of #{groups_count} ============="
STDERR.puts files_to_test.inspect
STDERR.puts "==============================================="
end
files_to_test.join(" ")
else
raise "Invalid value of GROUP env variable (#{ENV['GROUP']}). First number should be in 1..#{groups_count} range"
end
else
raise "Invalid value of GROUP env variable (#{ENV['GROUP']}). Expected e.g. GROUP=1of2"
end
else
args.join(" ")
end
end
|