xamarin-automators-calabash 0.1.5 → 0.1.6
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 +32 -20
- 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: c77e00f95f9e3e4400957387dab965cdea0260d8
|
4
|
+
data.tar.gz: 981669929456226e1eb2dccb0ec8464606471b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b695e4cba04c7c69c65b357a2e819fde7e6498b9f4069b317f6a15557b015f8deb198a74b300897eaeee9402b17352c8df39125569474e8b7a2787b32bb1ea
|
7
|
+
data.tar.gz: 1770ea36df57d1aab884cdbfa657f43f490611053c53f599af4d55907482477728171d30cf63685abeeb486bb1e54058e3fb505cd711fad942d07c7bc706ef91
|
@@ -3,15 +3,15 @@ require 'awesome_print'
|
|
3
3
|
#
|
4
4
|
|
5
5
|
def get_roots
|
6
|
-
all_items = query "*"
|
7
|
-
all_items.map {|x| x.delete("description")}
|
6
|
+
@all_items = query "*"
|
7
|
+
@all_items.map {|x| x.delete("description")}
|
8
8
|
roots = Hash.new
|
9
|
-
roots[0] = all_items[0]
|
9
|
+
roots[0] = @all_items[0]
|
10
10
|
print "Found root(s) at: 0"
|
11
|
-
(1..(all_items.count-1)).each do |i|
|
11
|
+
(1..(@all_items.count-1)).each do |i|
|
12
12
|
parents_children = query("* index:#{i} parent * index:0 child *")
|
13
13
|
parents_children.map {|x| x.delete("description")}
|
14
|
-
unless parents_children.include? all_items[i]
|
14
|
+
unless parents_children.include? @all_items[i]
|
15
15
|
print ", #{i}"
|
16
16
|
parent = query("* index:#{i} parent * index:0").first
|
17
17
|
unless parent.nil?
|
@@ -24,42 +24,54 @@ def get_roots
|
|
24
24
|
return roots
|
25
25
|
end
|
26
26
|
|
27
|
-
def print_tree(show_class=false)
|
27
|
+
def print_tree(show_class=false, show_index=false)
|
28
28
|
puts "Finding roots..."
|
29
29
|
@roots = get_roots
|
30
30
|
@count = 1
|
31
31
|
main_root = @roots[0]
|
32
32
|
@roots.delete(0)
|
33
|
-
print_tree_recurse("* index:0", (query "* index:0").first, 0, show_class)
|
33
|
+
print_tree_recurse("* index:0", (query "* index:0").first, 0, show_class, show_index)
|
34
34
|
@roots.each do |key, value|
|
35
35
|
@count += 1
|
36
36
|
puts "#{magenta("** Parent off of screen **")}"
|
37
|
-
print_tree_recurse("* index:#{key}", (query "* index:#{key}").first, 0, show_class)
|
37
|
+
print_tree_recurse("* index:#{key}", (query "* index:#{key}").first, 0, show_class, show_index)
|
38
38
|
end
|
39
39
|
"Found #{@count} nodes"
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
node
|
42
|
+
def roots_with_value(node)
|
43
|
+
return @roots.select {|k,v| v == node }
|
44
|
+
end
|
45
|
+
|
46
|
+
def print_tree_recurse(query, node, indent, show_class, show_index)
|
47
|
+
node.delete("description") unless node["description"].nil?
|
44
48
|
indent.times { print " " }
|
45
49
|
print "id: #{green(node["id"])} " unless node["id"].nil?
|
46
|
-
print "text: #{cyan(node["text"])} " unless node["text"].nil?
|
50
|
+
print "text: '#{cyan(node["text"])}' " unless node["text"].nil?
|
47
51
|
if show_class or (node["id"].nil? and node["text"].nil?)
|
48
|
-
print "class: #{yellow(node["class"].split(/[$.]/).last)}"
|
52
|
+
print "class: #{yellow(node["class"].split(/[$.]/).last)} "
|
53
|
+
end
|
54
|
+
if show_index
|
55
|
+
index = @all_items.index(node)
|
56
|
+
print "index: #{magenta("#{index}")} "
|
49
57
|
end
|
50
58
|
print "\n"
|
51
59
|
children = query("#{query} child *")
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
60
|
+
roots = roots_with_value(node)
|
61
|
+
if roots.size != 0
|
62
|
+
roots.each do |k,v|
|
63
|
+
sub_root_query = "* index:#{k}"
|
64
|
+
sub_root = query(sub_root_query).first
|
65
|
+
@roots.delete(k)
|
66
|
+
@count += 1
|
67
|
+
(indent+1).times { print " " }
|
68
|
+
print "#{magenta("**")}\n"
|
69
|
+
print_tree_recurse(sub_root_query, sub_root, indent+2, show_class, show_index)
|
70
|
+
end
|
59
71
|
end
|
60
72
|
(children.size).times do |i|
|
61
73
|
@count += 1
|
62
|
-
print_tree_recurse("#{query} child * index:#{i}", children[i], indent+1, show_class)
|
74
|
+
print_tree_recurse("#{query} child * index:#{i}", children[i], indent+1, show_class, show_index)
|
63
75
|
end
|
64
76
|
end
|
65
77
|
|