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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea85b7f08fecb201a92e569fcea0c37f25d02414
4
- data.tar.gz: 3bb42a67e5be62b6541130487c335f0fd0cc88e5
3
+ metadata.gz: 6b0b34a588b811a8758943787f15b6f55759b364
4
+ data.tar.gz: eb552923a0982f861e971f4f5c930ef3e0645d8a
5
5
  SHA512:
6
- metadata.gz: cb68626383d9a401cb6f1d89c35dee5a6f3fb079e89dbb68c8a832738007192ecf3af8cbed81991ecc57cd23a98d1ecaf39338e17eb710e1149d7c5bac37a3c9
7
- data.tar.gz: 9243ec6168df20fddd94dc169c2c31de345cf1126336a9e4308c5f317aa41f774cfab556140cf5f27cf18ea3b67bda0aeade7e2c50376ec6a3629618afc008dc
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
- @count = 1
5
- print_tree_recurse("child * parent * index:0", (query "* index:0").first, 0, show_class)
6
- return @count
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)}" if (node["id"].nil? and node["text"].nil?)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xamarin-automators-calabash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Roos