proc 0.14.0 → 0.15.0
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/CHANGELOG.md +8 -0
- data/lib/proc/callable.rb +2 -0
- data/lib/proc/client.rb +42 -9
- data/lib/proc/composition.rb +2 -0
- data/lib/proc/enumerator.rb +5 -0
- data/lib/proc/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c4e2f8e75f833c305540a05b7a5fb4b401f954296a68e8bd06dabf89be7042d
|
4
|
+
data.tar.gz: d254fb835c6d38bae8a7d5c2232f50cd05387ba7324280d1ba3c1761dec4525f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 022c5d8baf6791533e5d5407831a512e922f0013df71da6f35b4595f5c9ee6fc4a85cb01e909a9c9d9c2113a50be0a5818fe8a81ab3169d74fb2a0230b41912e
|
7
|
+
data.tar.gz: 41656a469f4b6505578ff2ecc0da00b77f3178904d8167964e4bdb6adbdcc9346230b9b9a1e1501be649993e7e475437a6727f83d4e1786d75fafb7036798f29
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [v0.15.0](https://github.com/metabahn/proc/releases/tag/2022-01-13)
|
2
|
+
|
3
|
+
*released on 2022-01-13*
|
4
|
+
|
5
|
+
* `dep` [#22](https://github.com/metabahn/proc/pull/22) Update dependencies ([bryanp](https://github.com/bryanp))
|
6
|
+
* `chg` [#20](https://github.com/metabahn/proc/pull/20) Rename client `request_count` to `count` ([bryanp](https://github.com/bryanp))
|
7
|
+
* `chg` [#16](https://github.com/metabahn/proc/pull/16) Update Ruby client to use proc.run ([bryanp](https://github.com/bryanp))
|
8
|
+
|
1
9
|
## [v0.14.0](https://github.com/metabahn/proc/releases/tag/2021-09-22)
|
2
10
|
|
3
11
|
*released on 2021-09-22*
|
data/lib/proc/callable.rb
CHANGED
data/lib/proc/client.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "core/async"
|
4
4
|
require "core/global"
|
5
|
+
require "core/inspect"
|
5
6
|
|
6
7
|
require "http"
|
7
8
|
require "msgpack"
|
@@ -76,6 +77,8 @@ class Proc
|
|
76
77
|
|
77
78
|
include ::Is::Async
|
78
79
|
include ::Is::Global
|
80
|
+
include ::Is::Inspectable
|
81
|
+
inspects :@scheme, :@host, ::Core::Inspect::Inspection.new(name: :@authorization, resolver: :safe_authorization), :@count
|
79
82
|
|
80
83
|
# [public] The configured authorization.
|
81
84
|
#
|
@@ -91,7 +94,7 @@ class Proc
|
|
91
94
|
|
92
95
|
# [public] The number of requests this client has performed.
|
93
96
|
#
|
94
|
-
attr_reader :
|
97
|
+
attr_reader :count
|
95
98
|
|
96
99
|
attr_reader :response
|
97
100
|
|
@@ -100,11 +103,11 @@ class Proc
|
|
100
103
|
"content-type" => "application/vnd.proc+msgpack"
|
101
104
|
}.freeze
|
102
105
|
|
103
|
-
def initialize(authorization = ::Proc::Client.authorization, scheme: "https", host: "
|
106
|
+
def initialize(authorization = ::Proc::Client.authorization, scheme: "https", host: "proc.run")
|
104
107
|
@authorization = authorization
|
105
108
|
@scheme = scheme
|
106
109
|
@host = host
|
107
|
-
@
|
110
|
+
@count = 0
|
108
111
|
|
109
112
|
@__base_url = "#{@scheme}://#{host}"
|
110
113
|
@__headers = {
|
@@ -217,10 +220,31 @@ class Proc
|
|
217
220
|
end
|
218
221
|
end
|
219
222
|
|
223
|
+
IGNORE_MISSING = %i[
|
224
|
+
].freeze
|
225
|
+
|
226
|
+
KERNEL_DELEGATE = %i[
|
227
|
+
class
|
228
|
+
instance_variables
|
229
|
+
instance_variable_get
|
230
|
+
instance_variable_set
|
231
|
+
object_id
|
232
|
+
public_send
|
233
|
+
respond_to?
|
234
|
+
].freeze
|
235
|
+
|
220
236
|
# [public] Allows callable contexts to be built through method lookups.
|
221
237
|
#
|
222
|
-
def method_missing(name, input = input_omitted = true,
|
223
|
-
if
|
238
|
+
def method_missing(name, input = input_omitted = true, *parameters, **arguments, &block)
|
239
|
+
if IGNORE_MISSING.include?(name)
|
240
|
+
super
|
241
|
+
elsif KERNEL_DELEGATE.include?(name)
|
242
|
+
if input_omitted
|
243
|
+
::Kernel.instance_method(name).bind_call(self, *parameters, **arguments, &block)
|
244
|
+
else
|
245
|
+
::Kernel.instance_method(name).bind_call(self, input, *parameters, **arguments, &block)
|
246
|
+
end
|
247
|
+
elsif input_omitted
|
224
248
|
::Proc::Callable.new(name, client: self, arguments: arguments)
|
225
249
|
else
|
226
250
|
::Proc::Callable.new(name, client: self, input: input, arguments: arguments)
|
@@ -238,6 +262,13 @@ class Proc
|
|
238
262
|
end
|
239
263
|
alias_method :arg, :argument
|
240
264
|
|
265
|
+
# [public] Returns a partial representation of the authorization that is safe to include in logs.
|
266
|
+
#
|
267
|
+
def safe_authorization
|
268
|
+
return unless @authorization
|
269
|
+
"#{@authorization[0..7]}...#{@authorization[-5..]}"
|
270
|
+
end
|
271
|
+
|
241
272
|
private def build_uri(proc)
|
242
273
|
::File.join(@__base_url, proc.to_s.split(".").join("/"))
|
243
274
|
end
|
@@ -246,16 +277,18 @@ class Proc
|
|
246
277
|
case value
|
247
278
|
when ::Symbol
|
248
279
|
["@@", value.to_s, {}]
|
249
|
-
when ::Proc::Composer::Argument, ::Proc::Callable, ::Proc::Composition
|
250
|
-
value.serialize
|
251
280
|
else
|
252
|
-
|
281
|
+
if value.respond_to?(:serialize)
|
282
|
+
value.serialize
|
283
|
+
else
|
284
|
+
["%%", value]
|
285
|
+
end
|
253
286
|
end
|
254
287
|
end
|
255
288
|
|
256
289
|
private def get_payload(proc:, body:)
|
257
290
|
await {
|
258
|
-
@
|
291
|
+
@count += 1
|
259
292
|
|
260
293
|
response = ::HTTP.headers(@__headers).post(build_uri(proc), body: ::MessagePack.pack(body))
|
261
294
|
|
data/lib/proc/composition.rb
CHANGED
data/lib/proc/enumerator.rb
CHANGED
data/lib/proc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: core-async
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.10'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: core-global
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: core-inspect
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: http
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
129
|
- !ruby/object:Gem::Version
|
116
130
|
version: '0'
|
117
131
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
132
|
+
rubygems_version: 3.3.3
|
119
133
|
signing_key:
|
120
134
|
specification_version: 4
|
121
135
|
summary: Proc client library.
|