github-ds 0.2.1 → 0.2.2
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 +10 -0
- data/examples/example_setup.rb +1 -1
- data/lib/github/ds/version.rb +1 -1
- data/lib/github/kv.rb +12 -16
- data/lib/github/sql.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71f03b79bb5da02405c55e147147550eede9a120
|
4
|
+
data.tar.gz: 69c8978ef97b5d7a45e005cbbdf371ce601c68bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d7c7c75907e73190497e58bdda8a9729a334e7aa05f6482c57ea1f0a48ed0db9871728604f7160e23d02e0d641d581241113d3f0bb85b90959c877b2fa84b44
|
7
|
+
data.tar.gz: 600871b7b135f7d0544e74e05921e97b1e6c292046b14306bbbe68155c3c8df7bb3a42a2abe18769db41c011787c82dfd1cd3d3411b3fd10ab8b55f92b413971
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.2.2
|
4
|
+
|
5
|
+
Additions
|
6
|
+
|
7
|
+
* `GitHub::KV` accepts `SQL::Literal` as valid values https://github.com/github/github-ds/pull/21/commits/c11d4e3154dd3435d509a3356f46d0a2981d7234
|
8
|
+
|
9
|
+
Fixes
|
10
|
+
|
11
|
+
* Value length validation takes into account that strings can be made of multi-byte characters https://github.com/github/github-ds/pull/21/commits/5156f95ef04b1ecf2ce90929c5752b2e61d39566
|
12
|
+
|
3
13
|
## 0.2.1
|
4
14
|
|
5
15
|
Additions
|
data/examples/example_setup.rb
CHANGED
data/lib/github/ds/version.rb
CHANGED
data/lib/github/kv.rb
CHANGED
@@ -271,14 +271,18 @@ module GitHub
|
|
271
271
|
end
|
272
272
|
|
273
273
|
private
|
274
|
-
def validate_key(key)
|
275
|
-
|
274
|
+
def validate_key(key, error_message: nil)
|
275
|
+
unless key.is_a?(String)
|
276
|
+
raise TypeError, error_message || "key must be a String in #{self.class.name}, but was #{key.class}"
|
277
|
+
end
|
276
278
|
|
277
279
|
validate_key_length(key)
|
278
280
|
end
|
279
281
|
|
280
|
-
def validate_value(value)
|
281
|
-
|
282
|
+
def validate_value(value, error_message: nil)
|
283
|
+
unless value.is_a?(String) || value.is_a?(GitHub::SQL::Literal)
|
284
|
+
raise TypeError, error_message || "value must be a String in #{self.class.name} or SQL::Literal, but was #{value.class}"
|
285
|
+
end
|
282
286
|
|
283
287
|
validate_value_length(value)
|
284
288
|
end
|
@@ -299,20 +303,12 @@ module GitHub
|
|
299
303
|
|
300
304
|
def validate_key_value_hash(kvs)
|
301
305
|
unless kvs.is_a?(Hash)
|
302
|
-
raise TypeError, "kvs must be a {String => String} in #{self.class.name}, but was #{
|
306
|
+
raise TypeError, "kvs must be a {String => String} in #{self.class.name}, but was #{kvs.class}"
|
303
307
|
end
|
304
308
|
|
305
309
|
kvs.each do |key, value|
|
306
|
-
|
307
|
-
|
308
|
-
end
|
309
|
-
|
310
|
-
unless value.is_a?(String)
|
311
|
-
raise TypeError, "kvs must be a {String => String} in #{self.class.name}, but also saw at least one value of type #{value.class}"
|
312
|
-
end
|
313
|
-
|
314
|
-
validate_key_length(key)
|
315
|
-
validate_value_length(value)
|
310
|
+
validate_key(key, error_message: "kvs must be a {String => [String | SQL::Literal]} in #{self.class.name}, but also saw at least one key of type #{key.class}")
|
311
|
+
validate_value(value, error_message: "kvs must be a {String => [String | SQL::Literal]} in #{self.class.name}, but also saw at least one value of type #{value.class}")
|
316
312
|
end
|
317
313
|
end
|
318
314
|
|
@@ -323,7 +319,7 @@ module GitHub
|
|
323
319
|
end
|
324
320
|
|
325
321
|
def validate_value_length(value)
|
326
|
-
if value.
|
322
|
+
if value.bytesize > MAX_VALUE_LENGTH
|
327
323
|
raise ValueLengthError, "value of length #{value.length} exceeds maximum value length of #{MAX_VALUE_LENGTH}"
|
328
324
|
end
|
329
325
|
end
|
data/lib/github/sql.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-ds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|