rollout 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rollout.rb +16 -31
- data/lib/rollout/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e144c36d4bea33448c00e67139f6a96b484a6880
|
4
|
+
data.tar.gz: b7de1dcc0f142ccefb919818837c832fb3d6534a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db1e11964fc48dd3fd2d1afe7eaa927ac7bea6929302f6c60257e0849e52a36fa585f1c7fc9b74e8e0f6ef4729df3d65b2535fafb9a5863cb0d9a57c71d60718
|
7
|
+
data.tar.gz: ed7d052d1851df8837a671607b4aa3e5a723a7da2ac3459cf28851243453affe934108bdd6c4f624a277322cd4fa983a0e17c9096b28a69c11cdd07050c35c2d
|
data/Gemfile.lock
CHANGED
data/lib/rollout.rb
CHANGED
@@ -107,7 +107,6 @@ class Rollout
|
|
107
107
|
@storage = storage
|
108
108
|
@options = opts
|
109
109
|
@groups = { all: lambda { |user| true } }
|
110
|
-
@legacy = Legacy.new(opts[:legacy_storage] || @storage) if opts[:migrate]
|
111
110
|
end
|
112
111
|
|
113
112
|
def activate(feature)
|
@@ -207,18 +206,7 @@ class Rollout
|
|
207
206
|
|
208
207
|
def get(feature)
|
209
208
|
string = @storage.get(key(feature))
|
210
|
-
|
211
|
-
Feature.new(feature, string, @options)
|
212
|
-
else
|
213
|
-
info = @legacy.info(feature)
|
214
|
-
f = Feature.new(feature)
|
215
|
-
f.percentage = info[:percentage]
|
216
|
-
f.percentage = 100 if info[:global].include? feature
|
217
|
-
f.groups = info[:groups].map { |g| g.to_sym }
|
218
|
-
f.users = info[:users].map { |u| u.to_s }
|
219
|
-
save(f)
|
220
|
-
f
|
221
|
-
end
|
209
|
+
Feature.new(feature, string, @options)
|
222
210
|
end
|
223
211
|
|
224
212
|
def features
|
@@ -247,26 +235,23 @@ class Rollout
|
|
247
235
|
end
|
248
236
|
|
249
237
|
private
|
250
|
-
def key(name)
|
251
|
-
"feature:#{name}"
|
252
|
-
end
|
253
238
|
|
254
|
-
|
255
|
-
|
256
|
-
|
239
|
+
def key(name)
|
240
|
+
"feature:#{name}"
|
241
|
+
end
|
257
242
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
save(f)
|
262
|
-
end
|
243
|
+
def features_key
|
244
|
+
"feature:__features__"
|
245
|
+
end
|
263
246
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
247
|
+
def with_feature(feature)
|
248
|
+
f = get(feature)
|
249
|
+
yield(f)
|
250
|
+
save(f)
|
251
|
+
end
|
268
252
|
|
269
|
-
|
270
|
-
|
271
|
-
|
253
|
+
def save(feature)
|
254
|
+
@storage.set(key(feature.name), feature.serialize)
|
255
|
+
@storage.set(features_key, (features | [feature.name.to_sym]).join(","))
|
256
|
+
end
|
272
257
|
end
|
data/lib/rollout/version.rb
CHANGED