xamarin-automators-calabash 0.0.12 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xamarin-automators-calabash.rb +22 -5
- 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: 6b0b34a588b811a8758943787f15b6f55759b364
|
4
|
+
data.tar.gz: eb552923a0982f861e971f4f5c930ef3e0645d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89e56cee00afb13bd6ad8893c1d3385d9b9041a50513c33c6e6964e406e1a8cff603a7cb69e163d1ef6ee42d6c83a2aae2c2facb55635f59482fef847d864215
|
7
|
+
data.tar.gz: 2d5f82591fdcf9879243aca984dab17383d71e54899d5b4bf2e5e94f0ee29f1ccc306c0cbbbcf2b3fd50f80d747df50e6e61575df1e2e7e71cffa36bc95d8ef5
|
@@ -1,17 +1,34 @@
|
|
1
1
|
require 'awesome_print'
|
2
2
|
|
3
|
+
def get_root_indexes
|
4
|
+
all_items = (query "*")
|
5
|
+
indexes = Array.new
|
6
|
+
(0..(all_items).count-1).each do |i|
|
7
|
+
parents_children = query("* index:#{i} parent * index:0 child *")
|
8
|
+
unless parents_children.include? all_items[i]
|
9
|
+
indexes.push i
|
10
|
+
end
|
11
|
+
end
|
12
|
+
return indexes
|
13
|
+
end
|
14
|
+
|
3
15
|
def print_tree(show_class=false)
|
4
|
-
|
5
|
-
|
6
|
-
|
16
|
+
roots = get_root_indexes
|
17
|
+
@count = roots.count
|
18
|
+
puts "Found roots #{roots.to_s}"
|
19
|
+
roots.each do |i|
|
20
|
+
print_tree_recurse("* index:#{i}", (query "* index:#{i}").first, 0, show_class)
|
21
|
+
end
|
22
|
+
# print_tree_recurse("child * parent * index:0", (query "* index:0").first, 0, show_class)
|
23
|
+
return "Number of nodes printed: #{@count}"
|
7
24
|
end
|
8
25
|
|
9
26
|
def print_tree_recurse(query, node, indent, show_class)
|
10
27
|
indent.times { print " " }
|
11
28
|
print "id: #{green(node["id"])} " unless node["id"].nil?
|
12
|
-
print "text: #{cyan(node["text"])}" unless node["text"].nil?
|
29
|
+
print "text: #{cyan(node["text"])} " unless node["text"].nil?
|
13
30
|
if show_class
|
14
|
-
print "class: #{yellow(node["class"].split(/[$.]/).last)}"
|
31
|
+
print "class: #{yellow(node["class"].split(/[$.]/).last)}"
|
15
32
|
else
|
16
33
|
print "--" if (node["id"].nil? and node["text"].nil?)
|
17
34
|
end
|