flok 0.0.103 → 0.0.105
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/app/drivers/chrome/config.yml +2 -0
- data/app/drivers/chrome/src/about.js +14 -0
- data/app/drivers/chrome/src/guid.js +9 -0
- data/app/drivers/chrome/src/net.js +25 -3
- data/app/kern/mod/about.js +19 -0
- data/app/kern/mod/hook.js +2 -2
- data/app/kern/mod/udid.js +9 -0
- data/app/kern/services/rest.rb +67 -8
- data/bin/flok +14 -0
- data/docs/mod/about.md +19 -0
- data/docs/mod/net.md +9 -4
- data/docs/mod/ui.md +1 -1
- data/docs/services/rest.md +24 -2
- data/docs/services/vm.md +4 -0
- data/docs/user_handbook/hooks.md +61 -5
- data/lib/flok/hooks_compiler.rb +6 -0
- data/lib/flok/user_compiler.rb +33 -5
- data/lib/flok/user_hook_generators/goto.rb +25 -3
- data/lib/flok/user_hook_generators/pop.rb +99 -0
- data/lib/flok/user_hook_generators/push.rb +119 -0
- data/lib/flok/version.rb +1 -1
- data/spec/iface/driver/about_spec.rb +14 -0
- data/spec/iface/driver/net_spec.rb +91 -2
- data/spec/iface/driver/ping_spec.rb +1 -0
- data/spec/kern/about_spec.rb +30 -0
- data/spec/kern/assets/hook_entry_points/controller0a_push.rb +31 -0
- data/spec/kern/assets/hook_entry_points/controller0b.rb +17 -0
- data/spec/kern/assets/hook_entry_points/controller0bc.rb +27 -0
- data/spec/kern/assets/hook_entry_points/controller_0b_pop.rb +18 -0
- data/spec/kern/assets/hook_entry_points/controller_0b_pop2.rb +66 -0
- data/spec/kern/assets/hook_entry_points/controller_0b_push.rb +15 -0
- data/spec/kern/assets/hook_entry_points/controller_0b_push2.rb +55 -0
- data/spec/kern/assets/rest_service/controller1b.rb +47 -0
- data/spec/kern/hook_entry_points_and_manifest_spec.rb +174 -0
- data/spec/kern/{hook_user_generators_spec.rb → hook_goto_user_generators_spec.rb} +145 -7
- data/spec/kern/hook_pop_user_generators_spec.rb +292 -0
- data/spec/kern/hook_push_user_generators_spec.rb +305 -0
- data/spec/kern/rest_service_spec.rb +97 -1
- data/spec/lib/helpers.rb +5 -3
- metadata +35 -5
- 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
|