bud 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -1
- data/docs/cheat.md +3 -3
- data/examples/{README → README.md} +0 -0
- data/lib/bud/bud_meta.rb +21 -13
- data/lib/bud/collections.rb +123 -130
- data/lib/bud/executor/elements.rb +27 -52
- data/lib/bud/executor/group.rb +1 -1
- data/lib/bud/executor/join.rb +7 -12
- data/lib/bud/rewrite.rb +83 -53
- data/lib/bud/storage/dbm.rb +2 -2
- data/lib/bud/viz_util.rb +4 -2
- data/lib/bud.rb +21 -7
- metadata +27 -68
- data/docs/bust.md +0 -83
- data/examples/bust/README.md +0 -9
- data/examples/bust/bustclient-example.rb +0 -23
- data/examples/bust/bustinspector.html +0 -135
- data/examples/bust/bustserver-example.rb +0 -18
- data/lib/bud/bust/bust.rb +0 -137
- data/lib/bud/bust/client/idempotence.rb +0 -10
- data/lib/bud/bust/client/restclient.rb +0 -49
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bud'
|
3
|
-
require 'nestful'
|
4
|
-
require 'bud/bust/client/idempotence'
|
5
|
-
|
6
|
-
module RestClient
|
7
|
-
include Idempotence # :nodoc: all
|
8
|
-
|
9
|
-
state do
|
10
|
-
# complains about underspecified dataflow because it can't see the
|
11
|
-
# nested rules...
|
12
|
-
interface input, :rest_req, [:rid, :verb, :form, :url, :params]
|
13
|
-
interface output, :rest_response, [:rid, :resp, :exception]
|
14
|
-
|
15
|
-
# we don't really need to store this i suppose
|
16
|
-
scratch :rest_req_thread, [:thread]
|
17
|
-
end
|
18
|
-
|
19
|
-
bloom :rest_client do
|
20
|
-
rest_req_thread <= rest_req.map do |req|
|
21
|
-
# start up a new thread to deal with the response
|
22
|
-
[Thread.start(req, self) do |r, bud|
|
23
|
-
params = (r.params or {})
|
24
|
-
begin
|
25
|
-
case r.verb
|
26
|
-
when :get
|
27
|
-
get_hash = {:params => params}
|
28
|
-
get_hash[:format] = r.form if r.form
|
29
|
-
resp_tuple = [r.rid, Nestful.get(r.url, get_hash), false]
|
30
|
-
when :post
|
31
|
-
# not sure if this is a sensible default for format?
|
32
|
-
format = (r.form or :form)
|
33
|
-
resp_tuple = [r.rid, Nestful.post(r.url, :format => format,
|
34
|
-
:params => params), false]
|
35
|
-
else
|
36
|
-
raise "invalid verb"
|
37
|
-
end
|
38
|
-
rescue
|
39
|
-
resp_tuple = [r.rid, "#{$!}", true]
|
40
|
-
end
|
41
|
-
# insert the response
|
42
|
-
bud.async_do do
|
43
|
-
rest_response <+ [resp_tuple]
|
44
|
-
end
|
45
|
-
end] if bust_idempotent [[req.rid, req.verb, req.form, req.url, req.params,
|
46
|
-
@budtime]]
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|