flok 0.0.103 → 0.0.105
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,305 @@
|
|
1
|
+
#Relating to the conversion of the user's ./config/hooks.rb file into the equivalent HooksManifestEntrie(s) (This may cross-over into
|
2
|
+
#the HooksCompiler itself because we need to test side-effects)
|
3
|
+
|
4
|
+
Dir.chdir File.join File.dirname(__FILE__), '../../'
|
5
|
+
require './spec/env/kern.rb'
|
6
|
+
require './spec/lib/helpers.rb'
|
7
|
+
require './spec/lib/io_extensions.rb'
|
8
|
+
require './spec/lib/rspec_extensions.rb'
|
9
|
+
require './lib/flok/hooks_compiler.rb'
|
10
|
+
require 'zlib'
|
11
|
+
|
12
|
+
RSpec.describe "kern:hook_push_user_generators_spec" do
|
13
|
+
include Zlib
|
14
|
+
include_context "kern"
|
15
|
+
|
16
|
+
it "Can use the :push hook generator for all controllers (no matchers)" do
|
17
|
+
hooks_src = %{
|
18
|
+
hook :push => :push do
|
19
|
+
#Select all
|
20
|
+
end
|
21
|
+
}
|
22
|
+
|
23
|
+
#Just expect this not to blow up
|
24
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push.rb'), nil, nil, hooks_src
|
25
|
+
ctx = info[:ctx]
|
26
|
+
|
27
|
+
#Run the embed function
|
28
|
+
dump = ctx.evald %{
|
29
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
30
|
+
int_dispatch([]); // Dispatch any events the are pending
|
31
|
+
dump.on_entry_base_pointer = on_entry_base_pointer;
|
32
|
+
}
|
33
|
+
|
34
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer"], "next_clicked", {} ]
|
35
|
+
|
36
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
37
|
+
@driver.get "if_hook_event", 0
|
38
|
+
end
|
39
|
+
|
40
|
+
it "Can use the :push hook generator for one specific controller by name" do
|
41
|
+
hooks_src = %{
|
42
|
+
hook :push => :push do
|
43
|
+
controller "my_controller"
|
44
|
+
end
|
45
|
+
}
|
46
|
+
|
47
|
+
#Just expect this not to blow up
|
48
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push2.rb'), nil, nil, hooks_src
|
49
|
+
ctx = info[:ctx]
|
50
|
+
|
51
|
+
#Run the embed function
|
52
|
+
dump = ctx.evald %{
|
53
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
54
|
+
int_dispatch([]); // Dispatch any events the are pending
|
55
|
+
dump.on_entry_base_pointer = on_entry_base_pointer;
|
56
|
+
dump.on_entry_base_pointer2 = on_entry_base_pointer2;
|
57
|
+
}
|
58
|
+
|
59
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer"], "next_clicked", {} ]
|
60
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
61
|
+
|
62
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
63
|
+
@driver.get "if_hook_event", 0
|
64
|
+
expect {@driver.ignore_up_to("if_hook_event", 0)}.to raise_error /Waited/
|
65
|
+
end
|
66
|
+
|
67
|
+
it "Can use the :push hook generator for one action that responds to something (going to thing)" do
|
68
|
+
hooks_src = %{
|
69
|
+
hook :push => :push do
|
70
|
+
to_action_responds_to? "test"
|
71
|
+
end
|
72
|
+
}
|
73
|
+
|
74
|
+
#Just expect this not to blow up
|
75
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push2.rb'), nil, nil, hooks_src
|
76
|
+
ctx = info[:ctx]
|
77
|
+
|
78
|
+
#Run the embed function
|
79
|
+
dump = ctx.evald %{
|
80
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
81
|
+
int_dispatch([]); // Dispatch any events the are pending
|
82
|
+
dump.on_entry_base_pointer = on_entry_base_pointer;
|
83
|
+
dump.on_entry_base_pointer2 = on_entry_base_pointer2;
|
84
|
+
}
|
85
|
+
|
86
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer"], "next_clicked", {} ]
|
87
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
88
|
+
|
89
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
90
|
+
res = @driver.get "if_hook_event", 0
|
91
|
+
expect {@driver.ignore_up_to("if_hook_event", 0)}.to raise_error /Waited/
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
it "Can use the :push hook generator for one action that responds to something (coming from thing)" do
|
96
|
+
hooks_src = %{
|
97
|
+
hook :push => :push do
|
98
|
+
from_action_responds_to? "olah"
|
99
|
+
end
|
100
|
+
}
|
101
|
+
|
102
|
+
#Just expect this not to blow up
|
103
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push2.rb'), nil, nil, hooks_src
|
104
|
+
ctx = info[:ctx]
|
105
|
+
|
106
|
+
#Run the embed function
|
107
|
+
dump = ctx.evald %{
|
108
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
109
|
+
int_dispatch([]); // Dispatch any events the are pending
|
110
|
+
dump.on_entry_base_pointer = on_entry_base_pointer;
|
111
|
+
dump.on_entry_base_pointer2 = on_entry_base_pointer2;
|
112
|
+
}
|
113
|
+
|
114
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer"], "next_clicked", {} ]
|
115
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
116
|
+
|
117
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
118
|
+
res = @driver.get "if_hook_event", 0
|
119
|
+
expect {@driver.ignore_up_to("if_hook_event", 0)}.to raise_error /Waited/
|
120
|
+
end
|
121
|
+
|
122
|
+
it "Can use the :push hook generator for a controller with the triggered_by constraint for various actions" do
|
123
|
+
#Hook source code
|
124
|
+
hooks_src = %{
|
125
|
+
hook :push => :push do
|
126
|
+
triggered_by "next_clicked"
|
127
|
+
end
|
128
|
+
}
|
129
|
+
|
130
|
+
#Get a new js context with the controllers source and the hooks source
|
131
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_pop2.rb'), nil, nil, hooks_src
|
132
|
+
File.write File.expand_path("~/Downloads/src.txt"), info[:src]
|
133
|
+
ctx = info[:ctx]
|
134
|
+
#Run the embed function
|
135
|
+
dump = ctx.evald %{
|
136
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
137
|
+
int_dispatch([]); // Dispatch any events the are pending
|
138
|
+
dump.on_entry_base_pointer = on_entry_base_pointer; // Grab the base address of 'my_other_controller'
|
139
|
+
}
|
140
|
+
|
141
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer"], "next_clicked", {} ]
|
142
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
it "can hook into a particualr action we are pushing to" do
|
147
|
+
hooks_src = %{
|
148
|
+
hook :push => :push do
|
149
|
+
to_action "other2"
|
150
|
+
end
|
151
|
+
}
|
152
|
+
|
153
|
+
#Just expect this not to blow up
|
154
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push2.rb'), nil, nil, hooks_src
|
155
|
+
ctx = info[:ctx]
|
156
|
+
|
157
|
+
#Run the embed function
|
158
|
+
dump = ctx.evald %{
|
159
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
160
|
+
int_dispatch([]); // Dispatch any events the are pending
|
161
|
+
dump.on_entry_base_pointer = on_entry_base_pointer;
|
162
|
+
dump.on_entry_base_pointer2 = on_entry_base_pointer2;
|
163
|
+
}
|
164
|
+
|
165
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer"], "next_clicked", {} ]
|
166
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
167
|
+
|
168
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
169
|
+
res = @driver.get "if_hook_event", 0
|
170
|
+
expect {@driver.ignore_up_to("if_hook_event", 0)}.to raise_error /Waited/
|
171
|
+
end
|
172
|
+
|
173
|
+
it "can hook into multiple particualr action we are pushing to" do
|
174
|
+
hooks_src = %{
|
175
|
+
hook :push => :push do
|
176
|
+
to_action "other", "other2"
|
177
|
+
end
|
178
|
+
}
|
179
|
+
|
180
|
+
#Just expect this not to blow up
|
181
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push2.rb'), nil, nil, hooks_src
|
182
|
+
ctx = info[:ctx]
|
183
|
+
|
184
|
+
#Run the embed function
|
185
|
+
dump = ctx.evald %{
|
186
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
187
|
+
int_dispatch([]); // Dispatch any events the are pending
|
188
|
+
dump.on_entry_base_pointer = on_entry_base_pointer;
|
189
|
+
dump.on_entry_base_pointer2 = on_entry_base_pointer2;
|
190
|
+
}
|
191
|
+
|
192
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer"], "next_clicked", {} ]
|
193
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
194
|
+
|
195
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
196
|
+
res = @driver.get "if_hook_event", 0
|
197
|
+
|
198
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
199
|
+
res = @driver.get "if_hook_event", 0
|
200
|
+
end
|
201
|
+
|
202
|
+
|
203
|
+
it "can hook into multiple action we are pushing from" do
|
204
|
+
hooks_src = %{
|
205
|
+
hook :push => :push do
|
206
|
+
from_action "index", "other2"
|
207
|
+
end
|
208
|
+
}
|
209
|
+
|
210
|
+
#Just expect this not to blow up
|
211
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push2.rb'), nil, nil, hooks_src
|
212
|
+
ctx = info[:ctx]
|
213
|
+
|
214
|
+
#Run the embed function
|
215
|
+
dump = ctx.evald %{
|
216
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
217
|
+
int_dispatch([]); // Dispatch any events the are pending
|
218
|
+
dump.on_entry_base_pointer = on_entry_base_pointer;
|
219
|
+
dump.on_entry_base_pointer2 = on_entry_base_pointer2;
|
220
|
+
}
|
221
|
+
|
222
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
223
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
224
|
+
|
225
|
+
@driver.ignore_up_to("if_hook_event", 0); @driver.get "if_hook_event", 0
|
226
|
+
@driver.ignore_up_to("if_hook_event", 0); @driver.get "if_hook_event", 0
|
227
|
+
end
|
228
|
+
|
229
|
+
it "can hook into a particular action we are pushing from" do
|
230
|
+
hooks_src = %{
|
231
|
+
hook :push => :push do
|
232
|
+
from_action "index"
|
233
|
+
end
|
234
|
+
}
|
235
|
+
|
236
|
+
#Just expect this not to blow up
|
237
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push2.rb'), nil, nil, hooks_src
|
238
|
+
ctx = info[:ctx]
|
239
|
+
|
240
|
+
#Run the embed function
|
241
|
+
dump = ctx.evald %{
|
242
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
243
|
+
int_dispatch([]); // Dispatch any events the are pending
|
244
|
+
dump.on_entry_base_pointer = on_entry_base_pointer;
|
245
|
+
dump.on_entry_base_pointer2 = on_entry_base_pointer2;
|
246
|
+
}
|
247
|
+
|
248
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
249
|
+
@driver.int "int_event", [ dump["on_entry_base_pointer2"], "next_clicked", {} ]
|
250
|
+
|
251
|
+
@driver.ignore_up_to("if_hook_event", 0); @driver.get "if_hook_event", 0
|
252
|
+
expect {@driver.ignore_up_to("if_hook_event", 0)}.to raise_error /Waited/
|
253
|
+
end
|
254
|
+
|
255
|
+
|
256
|
+
it "Can use push to embed a pre and post selectors which will be returned in the hooking response" do
|
257
|
+
#Hook source code
|
258
|
+
hooks_src = %{
|
259
|
+
hook :push => :push do
|
260
|
+
controller "my_controller"
|
261
|
+
to_action "other"
|
262
|
+
|
263
|
+
before_views({
|
264
|
+
"." => {
|
265
|
+
"__leaf__" => "foo"
|
266
|
+
}
|
267
|
+
})
|
268
|
+
|
269
|
+
after_views({
|
270
|
+
"my_controller3" => {
|
271
|
+
"__leaf__" => "foo2"
|
272
|
+
}
|
273
|
+
})
|
274
|
+
|
275
|
+
end
|
276
|
+
}
|
277
|
+
|
278
|
+
#Just expect this not to blow up
|
279
|
+
info = flok_new_user_with_src File.read('./spec/kern/assets/hook_entry_points/controller_0b_push2.rb'), nil, nil, hooks_src
|
280
|
+
ctx = info[:ctx]
|
281
|
+
|
282
|
+
#Run the embed function
|
283
|
+
ctx.evald %{
|
284
|
+
dump.base = _embed("my_controller", 0, {}, null); // Embed the controller
|
285
|
+
int_dispatch([]); // Dispatch any events the are pending
|
286
|
+
}
|
287
|
+
|
288
|
+
|
289
|
+
on_entry_base_pointer = ctx.eval("on_entry_base_pointer")
|
290
|
+
|
291
|
+
@driver.int "int_event", [ on_entry_base_pointer, "next_clicked", {} ]
|
292
|
+
my_controller3_base = ctx.eval("my_controller3_base")
|
293
|
+
on_entry_base_pointer2 = ctx.eval("on_entry_base_pointer2")
|
294
|
+
|
295
|
+
@driver.ignore_up_to("if_hook_event", 0)
|
296
|
+
hook_res = @driver.get "if_hook_event", 0
|
297
|
+
|
298
|
+
expect(hook_res[1]).to eq({
|
299
|
+
"views" => {
|
300
|
+
"foo" => on_entry_base_pointer2,
|
301
|
+
"foo2" => my_controller3_base
|
302
|
+
}
|
303
|
+
})
|
304
|
+
end
|
305
|
+
end
|
@@ -50,7 +50,7 @@ RSpec.describe "kern:rest_service" do
|
|
50
50
|
tp_base = msg.last
|
51
51
|
|
52
52
|
@driver.int "int_net_cb", [
|
53
|
-
tp_base,
|
53
|
+
tp_base, 200, {"foo" => "bar"}
|
54
54
|
]
|
55
55
|
|
56
56
|
dump = ctx.evald %{
|
@@ -59,9 +59,105 @@ RSpec.describe "kern:rest_service" do
|
|
59
59
|
|
60
60
|
expect(dump["rest_res_params"]).to eq({
|
61
61
|
"path" => "test",
|
62
|
+
"code" => 200,
|
62
63
|
"res" => {
|
63
64
|
"foo" => "bar"
|
64
65
|
}
|
65
66
|
})
|
66
67
|
end
|
68
|
+
|
69
|
+
it "Does automatically retry a network request after a 2 second timeout for a failed request" do
|
70
|
+
ctx = flok_new_user File.read('./spec/kern/assets/rest_service/controller1b.rb'), File.read("./spec/kern/assets/rest_service/config0.rb")
|
71
|
+
dump = ctx.evald %{
|
72
|
+
dump.base = _embed("my_controller", 0, {}, null);
|
73
|
+
|
74
|
+
//Drain queue
|
75
|
+
int_dispatch([]);
|
76
|
+
}
|
77
|
+
|
78
|
+
@driver.ignore_up_to("if_net_req")
|
79
|
+
msg = @driver.mexpect("if_net_req", ["GET", "http://localhost:8080/test", {"hello" => "world"}, Integer], 1) #network priority
|
80
|
+
|
81
|
+
#Last argument is teh tp_base for if_net_req
|
82
|
+
tp_base = msg.last
|
83
|
+
|
84
|
+
@driver.int "int_net_cb", [
|
85
|
+
tp_base, -1, "Error",
|
86
|
+
]
|
87
|
+
|
88
|
+
dump = ctx.evald %{
|
89
|
+
dump.rest_res_params = rest_res_params;
|
90
|
+
}
|
91
|
+
|
92
|
+
expect(dump["rest_res_params"]).to eq({
|
93
|
+
"path" => "test",
|
94
|
+
"code" => -1,
|
95
|
+
"res" => "Error"
|
96
|
+
})
|
97
|
+
|
98
|
+
#Increment the timers
|
99
|
+
(4*2).times do
|
100
|
+
@driver.int "int_timer", []
|
101
|
+
end
|
102
|
+
|
103
|
+
#Expect a signal for another network request
|
104
|
+
@driver.ignore_up_to("if_net_req")
|
105
|
+
msg = @driver.mexpect("if_net_req", ["GET", "http://localhost:8080/test", {"hello" => "world"}, Integer], 1) #network priority
|
106
|
+
tp_base = msg.last
|
107
|
+
|
108
|
+
@driver.int "int_net_cb", [
|
109
|
+
tp_base, -1, "Error2",
|
110
|
+
]
|
111
|
+
|
112
|
+
#Re-evaluate the results
|
113
|
+
dump = ctx.evald %{ dump.rest_res_params = rest_res_params; }
|
114
|
+
|
115
|
+
expect(dump["rest_res_params"]).to eq({
|
116
|
+
"path" => "test",
|
117
|
+
"code" => -1,
|
118
|
+
"res" => "Error2"
|
119
|
+
})
|
120
|
+
end
|
121
|
+
|
122
|
+
it "Does not automatically retry a network request after a 2 second timeout for a failed request where the view-controller is no longer available" do
|
123
|
+
ctx = flok_new_user File.read('./spec/kern/assets/rest_service/controller1b.rb'), File.read("./spec/kern/assets/rest_service/config0.rb")
|
124
|
+
ctx.evald %{
|
125
|
+
_embed("root_controller", 0, {}, null);
|
126
|
+
|
127
|
+
//Drain queue
|
128
|
+
int_dispatch([]);
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
@driver.ignore_up_to("if_net_req")
|
133
|
+
msg = @driver.mexpect("if_net_req", ["GET", "http://localhost:8080/test", {"hello" => "world"}, Integer], 1) #network priority
|
134
|
+
|
135
|
+
#Last argument is teh tp_base for if_net_req
|
136
|
+
tp_base = msg.last
|
137
|
+
|
138
|
+
@driver.int "int_net_cb", [
|
139
|
+
tp_base, -1, "Error",
|
140
|
+
]
|
141
|
+
|
142
|
+
dump = ctx.evald %{
|
143
|
+
dump.rest_res_params = rest_res_params;
|
144
|
+
dump.base = root_base
|
145
|
+
}
|
146
|
+
|
147
|
+
expect(dump["rest_res_params"]).to eq({
|
148
|
+
"path" => "test",
|
149
|
+
"code" => -1,
|
150
|
+
"res" => "Error"
|
151
|
+
})
|
152
|
+
|
153
|
+
@driver.int "int_event", [ dump["base"], "next_clicked", {} ]
|
154
|
+
|
155
|
+
#Increment the timers
|
156
|
+
(4*2).times do
|
157
|
+
@driver.int "int_timer", []
|
158
|
+
end
|
159
|
+
|
160
|
+
expect { @driver.ignore_up_to("if_net_req") }.to raise_error /Waited/
|
161
|
+
|
162
|
+
end
|
67
163
|
end
|
data/spec/lib/helpers.rb
CHANGED
@@ -78,7 +78,7 @@ module Webbing
|
|
78
78
|
@pipe.puts("ready")
|
79
79
|
}
|
80
80
|
@server.mount_proc '/' do |req, res|
|
81
|
-
@pipe.puts req.query.to_json
|
81
|
+
@pipe.puts({:params => req.query, :headers => req.header}.to_json)
|
82
82
|
res.body = @pipe.readline
|
83
83
|
res.header["Access-Control-Allow-Origin"] = "*"
|
84
84
|
res.header["Content-Type"] = "json/text"
|
@@ -96,8 +96,10 @@ module Webbing
|
|
96
96
|
Thread.new do
|
97
97
|
begin
|
98
98
|
loop do
|
99
|
-
|
100
|
-
|
99
|
+
info = JSON.parse(@pipe.readline)
|
100
|
+
params = info["params"]
|
101
|
+
headers = info["headers"]
|
102
|
+
res = @block.call(params, headers)
|
101
103
|
@pipe.puts res.to_json
|
102
104
|
end
|
103
105
|
rescue => e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.105
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -307,6 +307,7 @@ files:
|
|
307
307
|
- app/drivers/chrome/spec/spec/hook_spec.js
|
308
308
|
- app/drivers/chrome/spec/spec/sel_scope_spec.js
|
309
309
|
- app/drivers/chrome/spec/spec/vars_spec.js
|
310
|
+
- app/drivers/chrome/src/about.js
|
310
311
|
- app/drivers/chrome/src/bench.js
|
311
312
|
- app/drivers/chrome/src/config0.js
|
312
313
|
- app/drivers/chrome/src/controller.js
|
@@ -314,6 +315,7 @@ files:
|
|
314
315
|
- app/drivers/chrome/src/dispatch.js
|
315
316
|
- app/drivers/chrome/src/dlink.js
|
316
317
|
- app/drivers/chrome/src/event.js
|
318
|
+
- app/drivers/chrome/src/guid.js
|
317
319
|
- app/drivers/chrome/src/helpers.js
|
318
320
|
- app/drivers/chrome/src/hook.js
|
319
321
|
- app/drivers/chrome/src/net.js
|
@@ -333,6 +335,7 @@ files:
|
|
333
335
|
- app/kern/gen_id.js
|
334
336
|
- app/kern/kern_log.js
|
335
337
|
- app/kern/macro.rb
|
338
|
+
- app/kern/mod/about.js
|
336
339
|
- app/kern/mod/controller.js
|
337
340
|
- app/kern/mod/debug.js
|
338
341
|
- app/kern/mod/dlink.js
|
@@ -344,6 +347,7 @@ files:
|
|
344
347
|
- app/kern/mod/segue.js
|
345
348
|
- app/kern/mod/sockio.js
|
346
349
|
- app/kern/mod/timer.js
|
350
|
+
- app/kern/mod/udid.js
|
347
351
|
- app/kern/mod/ui.js
|
348
352
|
- app/kern/net_cb.js
|
349
353
|
- app/kern/pagers/pg_dummy.js
|
@@ -379,6 +383,7 @@ files:
|
|
379
383
|
- docs/kernel_handbook/find_view.md
|
380
384
|
- docs/kernel_handbook/hooks.md
|
381
385
|
- docs/messaging.md
|
386
|
+
- docs/mod/about.md
|
382
387
|
- docs/mod/controller.md
|
383
388
|
- docs/mod/debug.md
|
384
389
|
- docs/mod/debug/dump_ui.md
|
@@ -428,7 +433,8 @@ files:
|
|
428
433
|
- lib/flok/user_compiler.rb
|
429
434
|
- lib/flok/user_compiler_templates/ctable.js.erb
|
430
435
|
- lib/flok/user_hook_generators/goto.rb
|
431
|
-
- lib/flok/user_hook_generators/
|
436
|
+
- lib/flok/user_hook_generators/pop.rb
|
437
|
+
- lib/flok/user_hook_generators/push.rb
|
432
438
|
- lib/flok/utilities.rb
|
433
439
|
- lib/flok/version.rb
|
434
440
|
- logo.png
|
@@ -460,6 +466,7 @@ files:
|
|
460
466
|
- spec/etc/user_compiler/controller0bg.rb
|
461
467
|
- spec/etc/user_compiler/controller0timer.rb
|
462
468
|
- spec/etc/user_compiler/data.js
|
469
|
+
- spec/iface/driver/about_spec.rb
|
463
470
|
- spec/iface/driver/assets/debug_socket_server.js
|
464
471
|
- spec/iface/driver/assets/node_modules/socket.io/.npmignore
|
465
472
|
- spec/iface/driver/assets/node_modules/socket.io/.travis.yml
|
@@ -1190,6 +1197,7 @@ files:
|
|
1190
1197
|
- spec/iface/kern/net_spec.rb
|
1191
1198
|
- spec/iface/kern/ping_spec.rb
|
1192
1199
|
- spec/iface/kern/pipe_spec.rb
|
1200
|
+
- spec/kern/about_spec.rb
|
1193
1201
|
- spec/kern/assets/blank.rb
|
1194
1202
|
- spec/kern/assets/choose_action.rb
|
1195
1203
|
- spec/kern/assets/choose_action_sync.rb
|
@@ -1231,6 +1239,13 @@ files:
|
|
1231
1239
|
- spec/kern/assets/goto2.rb
|
1232
1240
|
- spec/kern/assets/hook_entry_points/controller0.rb
|
1233
1241
|
- spec/kern/assets/hook_entry_points/controller0a.rb
|
1242
|
+
- spec/kern/assets/hook_entry_points/controller0a_push.rb
|
1243
|
+
- spec/kern/assets/hook_entry_points/controller0b.rb
|
1244
|
+
- spec/kern/assets/hook_entry_points/controller0bc.rb
|
1245
|
+
- spec/kern/assets/hook_entry_points/controller_0b_pop.rb
|
1246
|
+
- spec/kern/assets/hook_entry_points/controller_0b_pop2.rb
|
1247
|
+
- spec/kern/assets/hook_entry_points/controller_0b_push.rb
|
1248
|
+
- spec/kern/assets/hook_entry_points/controller_0b_push2.rb
|
1234
1249
|
- spec/kern/assets/interval.rb
|
1235
1250
|
- spec/kern/assets/interval2.rb
|
1236
1251
|
- spec/kern/assets/interval3.rb
|
@@ -1244,6 +1259,7 @@ files:
|
|
1244
1259
|
- spec/kern/assets/rest_service/config0.rb
|
1245
1260
|
- spec/kern/assets/rest_service/controller0.rb
|
1246
1261
|
- spec/kern/assets/rest_service/controller1.rb
|
1262
|
+
- spec/kern/assets/rest_service/controller1b.rb
|
1247
1263
|
- spec/kern/assets/rest_service/controller2.rb
|
1248
1264
|
- spec/kern/assets/send_event.rb
|
1249
1265
|
- spec/kern/assets/service0.rb
|
@@ -1373,7 +1389,9 @@ files:
|
|
1373
1389
|
- spec/kern/functions_spec.rb
|
1374
1390
|
- spec/kern/global_functions_spec.rb
|
1375
1391
|
- spec/kern/hook_entry_points_and_manifest_spec.rb
|
1376
|
-
- spec/kern/
|
1392
|
+
- spec/kern/hook_goto_user_generators_spec.rb
|
1393
|
+
- spec/kern/hook_pop_user_generators_spec.rb
|
1394
|
+
- spec/kern/hook_push_user_generators_spec.rb
|
1377
1395
|
- spec/kern/rest_service_spec.rb
|
1378
1396
|
- spec/kern/rtc_spec.rb
|
1379
1397
|
- spec/kern/service_controller_spec.rb
|
@@ -1440,6 +1458,7 @@ test_files:
|
|
1440
1458
|
- spec/etc/user_compiler/controller0bg.rb
|
1441
1459
|
- spec/etc/user_compiler/controller0timer.rb
|
1442
1460
|
- spec/etc/user_compiler/data.js
|
1461
|
+
- spec/iface/driver/about_spec.rb
|
1443
1462
|
- spec/iface/driver/assets/debug_socket_server.js
|
1444
1463
|
- spec/iface/driver/assets/node_modules/socket.io/.npmignore
|
1445
1464
|
- spec/iface/driver/assets/node_modules/socket.io/.travis.yml
|
@@ -2170,6 +2189,7 @@ test_files:
|
|
2170
2189
|
- spec/iface/kern/net_spec.rb
|
2171
2190
|
- spec/iface/kern/ping_spec.rb
|
2172
2191
|
- spec/iface/kern/pipe_spec.rb
|
2192
|
+
- spec/kern/about_spec.rb
|
2173
2193
|
- spec/kern/assets/blank.rb
|
2174
2194
|
- spec/kern/assets/choose_action.rb
|
2175
2195
|
- spec/kern/assets/choose_action_sync.rb
|
@@ -2211,6 +2231,13 @@ test_files:
|
|
2211
2231
|
- spec/kern/assets/goto2.rb
|
2212
2232
|
- spec/kern/assets/hook_entry_points/controller0.rb
|
2213
2233
|
- spec/kern/assets/hook_entry_points/controller0a.rb
|
2234
|
+
- spec/kern/assets/hook_entry_points/controller0a_push.rb
|
2235
|
+
- spec/kern/assets/hook_entry_points/controller0b.rb
|
2236
|
+
- spec/kern/assets/hook_entry_points/controller0bc.rb
|
2237
|
+
- spec/kern/assets/hook_entry_points/controller_0b_pop.rb
|
2238
|
+
- spec/kern/assets/hook_entry_points/controller_0b_pop2.rb
|
2239
|
+
- spec/kern/assets/hook_entry_points/controller_0b_push.rb
|
2240
|
+
- spec/kern/assets/hook_entry_points/controller_0b_push2.rb
|
2214
2241
|
- spec/kern/assets/interval.rb
|
2215
2242
|
- spec/kern/assets/interval2.rb
|
2216
2243
|
- spec/kern/assets/interval3.rb
|
@@ -2224,6 +2251,7 @@ test_files:
|
|
2224
2251
|
- spec/kern/assets/rest_service/config0.rb
|
2225
2252
|
- spec/kern/assets/rest_service/controller0.rb
|
2226
2253
|
- spec/kern/assets/rest_service/controller1.rb
|
2254
|
+
- spec/kern/assets/rest_service/controller1b.rb
|
2227
2255
|
- spec/kern/assets/rest_service/controller2.rb
|
2228
2256
|
- spec/kern/assets/send_event.rb
|
2229
2257
|
- spec/kern/assets/service0.rb
|
@@ -2353,7 +2381,9 @@ test_files:
|
|
2353
2381
|
- spec/kern/functions_spec.rb
|
2354
2382
|
- spec/kern/global_functions_spec.rb
|
2355
2383
|
- spec/kern/hook_entry_points_and_manifest_spec.rb
|
2356
|
-
- spec/kern/
|
2384
|
+
- spec/kern/hook_goto_user_generators_spec.rb
|
2385
|
+
- spec/kern/hook_pop_user_generators_spec.rb
|
2386
|
+
- spec/kern/hook_push_user_generators_spec.rb
|
2357
2387
|
- spec/kern/rest_service_spec.rb
|
2358
2388
|
- spec/kern/rtc_spec.rb
|
2359
2389
|
- spec/kern/service_controller_spec.rb
|