xamarin-automators-calabash 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/xamarin-automators-calabash.rb +42 -35
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 337e9c7e621d4266d6168d47cf314d62f7a6399e
|
4
|
+
data.tar.gz: 60e11706822def97e8507a60ee0d523a92df704a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63a85aabd91faa936506e1e65688360454bce0406b226bd8a5c6bc70aca818f08b010edf66bf237e094d244ec3a52a4b92e0148c6b3da0aef843edd77334e8a4
|
7
|
+
data.tar.gz: 6e0e44624e8b2a574540b041f956b80c62c0af056f94aacc9927bbfc81865d2380527c55d2f8ef31b2a4c5ea0a3c3b3a22dd7ad9481df581f6553240f57be346
|
@@ -1,40 +1,41 @@
|
|
1
1
|
require 'awesome_print'
|
2
|
+
# print_tree calls print_tree_recurse with only index 0 and also hash of roots
|
3
|
+
#
|
2
4
|
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
return indexes
|
5
|
+
def get_roots
|
6
|
+
all_items = query "*"
|
7
|
+
all_items.map {|x| x.delete("description")}
|
8
|
+
roots = Hash.new
|
9
|
+
roots[0] = all_items[0]
|
10
|
+
print "Found root(s) at: 0"
|
11
|
+
(1..(all_items.count-1)).each do |i|
|
12
|
+
parents_children = query("* index:#{i} parent * index:0 child *")
|
13
|
+
parents_children.map {|x| x.delete("description")}
|
14
|
+
unless parents_children.include? all_items[i]
|
15
|
+
print ", #{i}"
|
16
|
+
parent = query("* index:#{i} parent * index:0").first
|
17
|
+
unless parent.nil?
|
18
|
+
parent.delete("description")
|
19
|
+
end
|
20
|
+
roots[i] = parent
|
21
|
+
end
|
22
|
+
end
|
23
|
+
print "\n"
|
24
|
+
return roots
|
24
25
|
end
|
25
26
|
|
26
27
|
def print_tree(show_class=false)
|
27
28
|
puts "Finding roots..."
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
return "Number of nodes printed: #{@count}"
|
29
|
+
roots = get_roots
|
30
|
+
@count = 1
|
31
|
+
main_root = roots[0]
|
32
|
+
roots.delete(0)
|
33
|
+
print_tree_recurse("* index:0", (query "* index:0").first, 0, show_class, roots)
|
34
|
+
"Found #{@count} nodes"
|
35
35
|
end
|
36
36
|
|
37
|
-
def print_tree_recurse(query, node, indent, show_class)
|
37
|
+
def print_tree_recurse(query, node, indent, show_class, roots)
|
38
|
+
node.delete("description")
|
38
39
|
indent.times { print " " }
|
39
40
|
print "id: #{green(node["id"])} " unless node["id"].nil?
|
40
41
|
print "text: #{cyan(node["text"])} " unless node["text"].nil?
|
@@ -44,17 +45,23 @@ def print_tree_recurse(query, node, indent, show_class)
|
|
44
45
|
print "--" if (node["id"].nil? and node["text"].nil?)
|
45
46
|
end
|
46
47
|
print "\n"
|
47
|
-
children = query
|
48
|
+
children = query("#{query} child *")
|
49
|
+
if roots.has_value?(node)
|
50
|
+
index = roots.key(node)
|
51
|
+
sub_root_query = "* index:#{index} child *"
|
52
|
+
sub_root_children = query(sub_root_query)
|
53
|
+
roots.delete(index)
|
54
|
+
(sub_root_children.size).times do |j|
|
55
|
+
@count += 1
|
56
|
+
print_tree_recurse(sub_root_query + " index:#{j}", sub_root_children[j], indent+1, show_class, roots)
|
57
|
+
end
|
58
|
+
end
|
48
59
|
(children.size).times do |i|
|
49
60
|
@count += 1
|
50
|
-
print_tree_recurse("#{query} child * index:#{i}", children[i], indent+1, show_class)
|
61
|
+
print_tree_recurse("#{query} child * index:#{i}", children[i], indent+1, show_class, roots)
|
51
62
|
end
|
52
63
|
end
|
53
64
|
|
54
|
-
def print_tree_partial(query, show_class=false)
|
55
|
-
print_tree_recurse("#{query} index:0", (query "#{query} index:0").first, 0, show_class)
|
56
|
-
end
|
57
|
-
|
58
65
|
def colorize(text, color_code)
|
59
66
|
"\e[#{color_code}m#{text}\e[0m"
|
60
67
|
end
|