flok 0.0.103 → 0.0.105

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/drivers/chrome/config.yml +2 -0
  3. data/app/drivers/chrome/src/about.js +14 -0
  4. data/app/drivers/chrome/src/guid.js +9 -0
  5. data/app/drivers/chrome/src/net.js +25 -3
  6. data/app/kern/mod/about.js +19 -0
  7. data/app/kern/mod/hook.js +2 -2
  8. data/app/kern/mod/udid.js +9 -0
  9. data/app/kern/services/rest.rb +67 -8
  10. data/bin/flok +14 -0
  11. data/docs/mod/about.md +19 -0
  12. data/docs/mod/net.md +9 -4
  13. data/docs/mod/ui.md +1 -1
  14. data/docs/services/rest.md +24 -2
  15. data/docs/services/vm.md +4 -0
  16. data/docs/user_handbook/hooks.md +61 -5
  17. data/lib/flok/hooks_compiler.rb +6 -0
  18. data/lib/flok/user_compiler.rb +33 -5
  19. data/lib/flok/user_hook_generators/goto.rb +25 -3
  20. data/lib/flok/user_hook_generators/pop.rb +99 -0
  21. data/lib/flok/user_hook_generators/push.rb +119 -0
  22. data/lib/flok/version.rb +1 -1
  23. data/spec/iface/driver/about_spec.rb +14 -0
  24. data/spec/iface/driver/net_spec.rb +91 -2
  25. data/spec/iface/driver/ping_spec.rb +1 -0
  26. data/spec/kern/about_spec.rb +30 -0
  27. data/spec/kern/assets/hook_entry_points/controller0a_push.rb +31 -0
  28. data/spec/kern/assets/hook_entry_points/controller0b.rb +17 -0
  29. data/spec/kern/assets/hook_entry_points/controller0bc.rb +27 -0
  30. data/spec/kern/assets/hook_entry_points/controller_0b_pop.rb +18 -0
  31. data/spec/kern/assets/hook_entry_points/controller_0b_pop2.rb +66 -0
  32. data/spec/kern/assets/hook_entry_points/controller_0b_push.rb +15 -0
  33. data/spec/kern/assets/hook_entry_points/controller_0b_push2.rb +55 -0
  34. data/spec/kern/assets/rest_service/controller1b.rb +47 -0
  35. data/spec/kern/hook_entry_points_and_manifest_spec.rb +174 -0
  36. data/spec/kern/{hook_user_generators_spec.rb → hook_goto_user_generators_spec.rb} +145 -7
  37. data/spec/kern/hook_pop_user_generators_spec.rb +292 -0
  38. data/spec/kern/hook_push_user_generators_spec.rb +305 -0
  39. data/spec/kern/rest_service_spec.rb +97 -1
  40. data/spec/lib/helpers.rb +5 -3
  41. metadata +35 -5
  42. data/lib/flok/user_hook_generators/helpers.rb +0 -46
@@ -1,46 +0,0 @@
1
- module Flok
2
- #This class helps construct javascript expressions like ((a == 3 || b == 4) && (a == 5 || c == 6))
3
- #Usually you have an outer-level JSTermGroup that represents all the things being anded togeather
4
- #and then you have multiple inner groups that each represent ored terms. Search POS form on wikipedia
5
- #e.g.
6
- # #Convert ((a == 3 || b == 4) && (a == 5 || c == 6))
7
- #
8
- # This will hold the entire result
9
- # ands = JSTermGroup.new
10
- #
11
- # Compute a small section of the result, the group (a == 3 || b == 4) and
12
- # then add it as a group of the entire result in || form
13
- # ors1 = JSTermGroup.new
14
- # ors1 << "a == 3"
15
- # ors1 << "b == 4"
16
- # ands << ors1.to_or_js
17
- #
18
- # Same thing but now we compute the second part which is (a == 5 || c == 5)
19
- # ors2 = JSTermGroup.new
20
- # ors2 << "a == 5"
21
- # ors2 << "c == 6"
22
- # ands << ors2.to_or_js
23
- #
24
- # Finally get the result by &&ing all the ||s groups togeather
25
- # result = ands.to_and_js
26
- class JSTermGroup
27
- def initialize
28
- @terms = []
29
- end
30
-
31
- #Add a javascript expression that evaluates to either true or false. May or may not contain parantheses
32
- def << expr
33
- @terms << "(#{expr})"
34
- end
35
-
36
- #Join expressions via || statements and yield an expression that contains parantheses
37
- def to_or_js
38
- "(#{[*@terms, "false"].join(" || ")})"
39
- end
40
-
41
- #Join expressions via && statements and yield an expression that contains parantheses
42
- def to_and_js
43
- "(#{[*@terms, "true"].join(" && ")})"
44
- end
45
- end
46
- end