cucumber_runner 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cucumber_runner +92 -5
- data/lib/cucumber_runner/version.rb +1 -1
- metadata +3 -3
data/bin/cucumber_runner
CHANGED
@@ -1,34 +1,114 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
|
4
|
+
def display_help
|
5
|
+
puts "cucumber_runner:
|
4
6
|
|
7
|
+
runs cucumber scenarios by their name individully
|
8
|
+
-h, show this help page
|
9
|
+
--user_zeus, use zeus or not
|
5
10
|
|
11
|
+
example:
|
12
|
+
cucumber_runner ios_feature --use_zeus
|
6
13
|
|
7
|
-
|
14
|
+
"
|
15
|
+
end
|
8
16
|
|
9
17
|
|
18
|
+
# filter the args
|
19
|
+
def filter_args
|
10
20
|
|
11
|
-
|
21
|
+
while arg= ARGV.shift
|
22
|
+
|
23
|
+
|
24
|
+
case arg
|
25
|
+
when "-h"
|
26
|
+
@ask_help=true
|
27
|
+
when "--use_zeus"
|
28
|
+
@use_zeus=true
|
29
|
+
else
|
30
|
+
@feature_dir = arg
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
#check help
|
35
|
+
if @ask_help
|
36
|
+
display_help
|
37
|
+
exit! 0
|
38
|
+
end
|
39
|
+
|
40
|
+
#if use zeus and zeus is not running, exit
|
41
|
+
if @use_zeus
|
12
42
|
|
13
|
-
|
14
|
-
|
43
|
+
ps_line =`ps aux |grep zeus`
|
44
|
+
#puts ps_line
|
45
|
+
if ps_line.lines.count<4
|
46
|
+
puts "you have to start zeus first"
|
47
|
+
exit! 0
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
15
53
|
|
16
54
|
|
55
|
+
|
56
|
+
# construct the cucumber command
|
57
|
+
def form_command
|
58
|
+
|
59
|
+
@zeus = @use_zeus.nil?? "": "zeus"
|
60
|
+
@feature_dir = @feature_dir.nil?? "": @feature_dir
|
61
|
+
@cmd = "#{@zeus} cucumber #{@feature_dir} " << " -d -f Cucumber::Formatter::ListScenarioName"
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
#get names dict from the tmp file
|
67
|
+
def get_cucumber_scenario_names
|
68
|
+
|
69
|
+
%x{ #{@cmd} }
|
17
70
|
File.open('/tmp/cucumber_runner.tmp','r') do |f|
|
18
71
|
@@names= Marshal.load(f.read())
|
19
72
|
end
|
20
73
|
print_names
|
21
74
|
end
|
22
75
|
|
76
|
+
#print scenarios names
|
23
77
|
def print_names
|
24
78
|
|
79
|
+
i=0
|
80
|
+
@@flatten_names ={}
|
25
81
|
@@names.each {|key,value|
|
26
82
|
puts key
|
27
|
-
value.
|
83
|
+
value.each_with_index {|tag,index|
|
84
|
+
key = "#{i}#{index}"
|
85
|
+
puts "\t\t#{key} #{tag}"
|
86
|
+
@@flatten_names[key]=tag
|
87
|
+
}
|
88
|
+
i+=1
|
28
89
|
}
|
29
90
|
|
30
91
|
end
|
31
92
|
|
93
|
+
#the heavy lifting,
|
94
|
+
def run_cmd(cmd)
|
95
|
+
#get continuous output
|
96
|
+
IO.popen cmd do |fd|
|
97
|
+
until fd.eof?
|
98
|
+
puts fd.readline
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
filter_args
|
111
|
+
form_command
|
32
112
|
get_cucumber_scenario_names
|
33
113
|
|
34
114
|
|
@@ -39,6 +119,13 @@ while input = gets.chomp
|
|
39
119
|
|
40
120
|
when 'S'
|
41
121
|
exit 0
|
122
|
+
else
|
123
|
+
|
124
|
+
if @@flatten_names.has_key?input
|
125
|
+
cmd = "#{@zeus} cucumber #{@feature_dir} -n \"#{@@flatten_names[input]}\" "
|
126
|
+
puts cmd
|
127
|
+
run_cmd cmd
|
128
|
+
end
|
42
129
|
|
43
130
|
end
|
44
131
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: list cucumber scenarios names, and run them
|
15
15
|
email:
|
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
52
|
rubyforge_project:
|
53
|
-
rubygems_version: 1.8.
|
53
|
+
rubygems_version: 1.8.24
|
54
54
|
signing_key:
|
55
55
|
specification_version: 3
|
56
56
|
summary: list cucumber scenarios names, and run them
|