molasses 0.3.0 → 0.4.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/lib/molasses.rb +4 -0
- data/spec/molasses_spec.rb +157 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42083df0653fde203c183ed8ca245ac17a9775c91b38a5b29fc4c4cd8daeb20f
|
4
|
+
data.tar.gz: 8462ce48c1c8fdca83b4afbd9f88916f7446e8599a6a95cd13f994861518ad06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 870f6b7e93f799a977bc527315c682b44b8b87137165086e0903ee1a7243cd3817b629f388e747b998f00e9c7e6f7438ff8e996877db4c11c0e074ef36fc4666
|
7
|
+
data.tar.gz: 89985334bb33c925721e43188c418414ff290e9693a2b2ffe857ed24f69dc072878ae3940a635ef2a27136feaaa07788e542c7c9aa26b13e509104997e376c80
|
data/lib/molasses.rb
CHANGED
@@ -3,6 +3,7 @@ require "workers"
|
|
3
3
|
require "faraday"
|
4
4
|
require "json"
|
5
5
|
require "zlib"
|
6
|
+
require "semantic"
|
6
7
|
|
7
8
|
module Molasses
|
8
9
|
class Client
|
@@ -212,6 +213,9 @@ module Molasses
|
|
212
213
|
when "boolean"
|
213
214
|
user_value = parse_bool(user_value)
|
214
215
|
constraint_value = parse_bool(constraint_value)
|
216
|
+
when "semver"
|
217
|
+
user_value = Semantic.parse_version(user_value)
|
218
|
+
constraint_value = Semantic.parse_version(constraint_value)
|
215
219
|
else
|
216
220
|
user_value = user_value.to_s
|
217
221
|
end
|
data/spec/molasses_spec.rb
CHANGED
@@ -165,6 +165,65 @@ responseC = {
|
|
165
165
|
},
|
166
166
|
],
|
167
167
|
},
|
168
|
+
{
|
169
|
+
"id": "4",
|
170
|
+
"active": true,
|
171
|
+
"description": "bar",
|
172
|
+
"key": "semver",
|
173
|
+
"segments": [
|
174
|
+
{
|
175
|
+
"percentage": 100,
|
176
|
+
"segmentType": "alwaysExperiment",
|
177
|
+
"constraint": "any",
|
178
|
+
"userConstraints": [
|
179
|
+
{
|
180
|
+
"userParam": "lt",
|
181
|
+
"userParamType": "semver",
|
182
|
+
"operator": "lt",
|
183
|
+
"values": "1.2.0",
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"userParam": "lte",
|
187
|
+
"userParamType": "semver",
|
188
|
+
"operator": "lte",
|
189
|
+
"values": "1.2.0",
|
190
|
+
},
|
191
|
+
{
|
192
|
+
"userParam": "gt",
|
193
|
+
"userParamType": "semver",
|
194
|
+
"operator": "gt",
|
195
|
+
"values": "1.2.0",
|
196
|
+
},
|
197
|
+
{
|
198
|
+
"userParam": "gte",
|
199
|
+
"userParamType": "semver",
|
200
|
+
"operator": "gte",
|
201
|
+
"values": "1.2.0",
|
202
|
+
},
|
203
|
+
{
|
204
|
+
"userParam": "equals",
|
205
|
+
"userParamType": "semver",
|
206
|
+
"operator": "equals",
|
207
|
+
"values": "1.2.0",
|
208
|
+
},
|
209
|
+
{
|
210
|
+
"userParam": "doesNotEqual",
|
211
|
+
"userParamType": "semver",
|
212
|
+
"operator": "doesNotEqual",
|
213
|
+
"values": "1.2.0",
|
214
|
+
},
|
215
|
+
|
216
|
+
],
|
217
|
+
|
218
|
+
},
|
219
|
+
{
|
220
|
+
"constraint": "all",
|
221
|
+
"percentage": 0,
|
222
|
+
"segmentType": "everyoneElse",
|
223
|
+
"userConstraints": [],
|
224
|
+
},
|
225
|
+
],
|
226
|
+
},
|
168
227
|
{
|
169
228
|
"id": "1",
|
170
229
|
"active": true,
|
@@ -372,6 +431,104 @@ RSpec.describe Molasses::Client do
|
|
372
431
|
},
|
373
432
|
})).to be_falsy
|
374
433
|
|
434
|
+
expect(client.is_active("semver", {
|
435
|
+
"id" => "123444", # valid crc32 percentage
|
436
|
+
"params" => {
|
437
|
+
"lt" => "1.1",
|
438
|
+
},
|
439
|
+
})).to be_truthy
|
440
|
+
|
441
|
+
expect(client.is_active("semver", {
|
442
|
+
"id" => "123444", # valid crc32 percentage
|
443
|
+
"params" => {
|
444
|
+
"lt" => "1.2.0",
|
445
|
+
},
|
446
|
+
})).to be_falsy
|
447
|
+
|
448
|
+
expect(client.is_active("semver", {
|
449
|
+
"id" => "123444", # valid crc32 percentage
|
450
|
+
"params" => {
|
451
|
+
"gt" => "1.3.0",
|
452
|
+
},
|
453
|
+
})).to be_truthy
|
454
|
+
|
455
|
+
expect(client.is_active("semver", {
|
456
|
+
"id" => "123444", # valid crc32 percentage
|
457
|
+
"params" => {
|
458
|
+
"gt" => "1.2.0",
|
459
|
+
},
|
460
|
+
})).to be_falsy
|
461
|
+
|
462
|
+
expect(client.is_active("semver", {
|
463
|
+
"id" => "123444", # valid crc32 percentage
|
464
|
+
"params" => {
|
465
|
+
"lte" => "1.1",
|
466
|
+
},
|
467
|
+
})).to be_truthy
|
468
|
+
|
469
|
+
expect(client.is_active("semver", {
|
470
|
+
"id" => "123444", # valid crc32 percentage
|
471
|
+
"params" => {
|
472
|
+
"lte" => "1.2.0",
|
473
|
+
},
|
474
|
+
})).to be_truthy
|
475
|
+
|
476
|
+
expect(client.is_active("semver", {
|
477
|
+
"id" => "123444", # valid crc32 percentage
|
478
|
+
"params" => {
|
479
|
+
"lte" => "1.3.0",
|
480
|
+
},
|
481
|
+
})).to be_falsy
|
482
|
+
|
483
|
+
expect(client.is_active("semver", {
|
484
|
+
"id" => "123444", # valid crc32 percentage
|
485
|
+
"params" => {
|
486
|
+
"gte" => "1.3.0",
|
487
|
+
},
|
488
|
+
})).to be_truthy
|
489
|
+
|
490
|
+
expect(client.is_active("semver", {
|
491
|
+
"id" => "123444", # valid crc32 percentage
|
492
|
+
"params" => {
|
493
|
+
"gte" => "1.2.0",
|
494
|
+
},
|
495
|
+
})).to be_truthy
|
496
|
+
|
497
|
+
expect(client.is_active("semver", {
|
498
|
+
"id" => "123444", # valid crc32 percentage
|
499
|
+
"params" => {
|
500
|
+
"gte" => "0.1.0",
|
501
|
+
},
|
502
|
+
})).to be_falsy
|
503
|
+
|
504
|
+
expect(client.is_active("semver", {
|
505
|
+
"id" => "123444", # valid crc32 percentage
|
506
|
+
"params" => {
|
507
|
+
"equals" => "1.2.0",
|
508
|
+
},
|
509
|
+
})).to be_truthy
|
510
|
+
|
511
|
+
expect(client.is_active("semver", {
|
512
|
+
"id" => "123444", # valid crc32 percentage
|
513
|
+
"params" => {
|
514
|
+
"equals" => "1.3.0",
|
515
|
+
},
|
516
|
+
})).to be_falsy
|
517
|
+
|
518
|
+
expect(client.is_active("semver", {
|
519
|
+
"id" => "123444", # valid crc32 percentage
|
520
|
+
"params" => {
|
521
|
+
"doesNotEqual" => "1.3.0",
|
522
|
+
},
|
523
|
+
})).to be_truthy
|
524
|
+
|
525
|
+
expect(client.is_active("semver", {
|
526
|
+
"id" => "123444", # valid crc32 percentage
|
527
|
+
"params" => {
|
528
|
+
"doesNotEqual" => "1.2.0",
|
529
|
+
},
|
530
|
+
})).to be_falsy
|
531
|
+
|
375
532
|
expect(client.is_active("NUMBERS_BOOLS", {
|
376
533
|
"id" => "123444", # valid crc32 percentage
|
377
534
|
"params" => {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: molasses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Hrisho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.6.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: semantic
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.6.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.1
|
41
55
|
description: Ruby SDK for Molasses. Feature flags as a service
|
42
56
|
email: james.hrisho@gmail.com
|
43
57
|
executables: []
|
@@ -67,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
requirements: []
|
70
|
-
rubygems_version: 3.0.3
|
84
|
+
rubygems_version: 3.0.3.1
|
71
85
|
signing_key:
|
72
86
|
specification_version: 4
|
73
87
|
summary: Ruby SDK for Molasses. Feature flags as a service
|