rollout_ui2 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce907ff7bbb649b20c8be24096131a1974de42c6
4
- data.tar.gz: 834521e842e1738ffb7f985e1834b4e75ca5ba16
3
+ metadata.gz: c78a1082227ed2ebf2272105c2a73e13a4990a38
4
+ data.tar.gz: d69053e638b919d9a874eefa165411b4268ac00b
5
5
  SHA512:
6
- metadata.gz: 23819008cfddccef9e4ce3b451a67a622dbc297092eef6a8e5b76f8ea13c8eb9127dc0f29df33f8213b241904552fe02bebcf4080780309d8ae730d5066eeb70
7
- data.tar.gz: ae19ec26f138269cfaed6b63362182c843dbe4b832eabf928c1dcf2523476ad0bbfcc832dea9703c203c8089d9e74cb6f4b3ae65320b5150d382661e5ae1d244
6
+ metadata.gz: d74255e72cbd7e4a7bdc7ed23c0a501bae7cd53b553094f85e4dc9398bbbddea4a80da251c7d7d2f3bbcd13bd13f5f6cdab0c9a459b6d645e09afec4a208c91a
7
+ data.tar.gz: d772beda13661b87674bf9f762a2a425b2806b70d6833e9e0a9e64de2daac11a4dc87cec5ba871c16799c878e3de82dc10ae6e7b52474fc627cf864a8fc559d1
@@ -1,2 +1,2 @@
1
1
  ---
2
- BUNDLE_DISABLE_SHARED_GEMS: '1'
2
+ BUNDLE_DISABLE_SHARED_GEMS: "true"
data/example_rack/Gemfile CHANGED
@@ -4,5 +4,6 @@ gem 'rerun'
4
4
  gem 'pry'
5
5
  gem 'redis'
6
6
  gem 'rollout', '>= 2.0.0'
7
+ gem 'redis-namespace'
7
8
 
8
9
  gem 'rollout_ui2', path: '..'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rollout_ui2 (0.2.0)
4
+ rollout_ui2 (0.4.0)
5
5
  sinatra (~> 1.4, >= 1.4.7)
6
6
 
7
7
  GEM
@@ -25,6 +25,8 @@ GEM
25
25
  rb-inotify (0.9.7)
26
26
  ffi (>= 0.5.0)
27
27
  redis (3.3.2)
28
+ redis-namespace (1.5.2)
29
+ redis (~> 3.0, >= 3.0.4)
28
30
  rerun (0.11.0)
29
31
  listen (~> 3.0)
30
32
  rollout (2.4.0)
@@ -42,6 +44,7 @@ PLATFORMS
42
44
  DEPENDENCIES
43
45
  pry
44
46
  redis
47
+ redis-namespace
45
48
  rerun
46
49
  rollout (>= 2.0.0)
47
50
  rollout_ui2!
@@ -1,6 +1,6 @@
1
1
  require 'rollout'
2
2
  require 'rollout_ui2'
3
- require 'redis'
3
+ require 'redis-namespace'
4
4
 
5
5
  USERS = [ { id: 1,
6
6
  text: "jimi.lepisto@example.com",
@@ -33,8 +33,612 @@ USERS = [ { id: 1,
33
33
  text: "stacey.olson@example.com",
34
34
  picture: "https://randomuser.me/api/portraits/thumb/women/3.jpg" } ]
35
35
 
36
- class User
37
- def self.find_by_id(ids)
36
+ COUNTRIES = [
37
+ { id: "af",
38
+ text: "Afghanistan",
39
+ picture: "http://flags.fmcdn.net/data/flags/mini/af.png" },
40
+ { id: "al",
41
+ text: "Albania",
42
+ picture: "http://flags.fmcdn.net/data/flags/mini/al.png" },
43
+ { id: "dz",
44
+ text: "Algeria",
45
+ picture: "http://flags.fmcdn.net/data/flags/mini/dz.png" },
46
+ { id: "ad",
47
+ text: "Andorra",
48
+ picture: "http://flags.fmcdn.net/data/flags/mini/ad.png" },
49
+ { id: "ao",
50
+ text: "Angola",
51
+ picture: "http://flags.fmcdn.net/data/flags/mini/ao.png" },
52
+ { id: "ag",
53
+ text: "Antigua and Barbuda",
54
+ picture: "http://flags.fmcdn.net/data/flags/mini/ag.png" },
55
+ { id: "ar",
56
+ text: "Argentina",
57
+ picture: "http://flags.fmcdn.net/data/flags/mini/ar.png" },
58
+ { id: "am",
59
+ text: "Armenia",
60
+ picture: "http://flags.fmcdn.net/data/flags/mini/am.png" },
61
+ { id: "au",
62
+ text: "Australia",
63
+ picture: "http://flags.fmcdn.net/data/flags/mini/au.png" },
64
+ { id: "at",
65
+ text: "Austria",
66
+ picture: "http://flags.fmcdn.net/data/flags/mini/at.png" },
67
+ { id: "az",
68
+ text: "Azerbaijan",
69
+ picture: "http://flags.fmcdn.net/data/flags/mini/az.png" },
70
+ { id: "bs",
71
+ text: "Bahamas",
72
+ picture: "http://flags.fmcdn.net/data/flags/mini/bs.png" },
73
+ { id: "bh",
74
+ text: "Bahrain",
75
+ picture: "http://flags.fmcdn.net/data/flags/mini/bh.png" },
76
+ { id: "bd",
77
+ text: "Bangladesh",
78
+ picture: "http://flags.fmcdn.net/data/flags/mini/bd.png" },
79
+ { id: "bb",
80
+ text: "Barbados",
81
+ picture: "http://flags.fmcdn.net/data/flags/mini/bb.png" },
82
+ { id: "by",
83
+ text: "Belarus",
84
+ picture: "http://flags.fmcdn.net/data/flags/mini/by.png" },
85
+ { id: "be",
86
+ text: "Belgium",
87
+ picture: "http://flags.fmcdn.net/data/flags/mini/be.png" },
88
+ { id: "bz",
89
+ text: "Belize",
90
+ picture: "http://flags.fmcdn.net/data/flags/mini/bz.png" },
91
+ { id: "bj",
92
+ text: "Benin",
93
+ picture: "http://flags.fmcdn.net/data/flags/mini/bj.png" },
94
+ { id: "bt",
95
+ text: "Bhutan",
96
+ picture: "http://flags.fmcdn.net/data/flags/mini/bt.png" },
97
+ { id: "bo",
98
+ text: "Bolivia",
99
+ picture: "http://flags.fmcdn.net/data/flags/mini/bo.png" },
100
+ { id: "ba",
101
+ text: "Bosnia and Herzegovina",
102
+ picture: "http://flags.fmcdn.net/data/flags/mini/ba.png" },
103
+ { id: "bw",
104
+ text: "Botswana",
105
+ picture: "http://flags.fmcdn.net/data/flags/mini/bw.png" },
106
+ { id: "br",
107
+ text: "Brazil",
108
+ picture: "http://flags.fmcdn.net/data/flags/mini/br.png" },
109
+ { id: "bn",
110
+ text: "Brunei",
111
+ picture: "http://flags.fmcdn.net/data/flags/mini/bn.png" },
112
+ { id: "bg",
113
+ text: "Bulgaria",
114
+ picture: "http://flags.fmcdn.net/data/flags/mini/bg.png" },
115
+ { id: "bf",
116
+ text: "Burkina Faso",
117
+ picture: "http://flags.fmcdn.net/data/flags/mini/bf.png" },
118
+ { id: "bi",
119
+ text: "Burundi",
120
+ picture: "http://flags.fmcdn.net/data/flags/mini/bi.png" },
121
+ { id: "kh",
122
+ text: "Cambodia",
123
+ picture: "http://flags.fmcdn.net/data/flags/mini/kh.png" },
124
+ { id: "cm",
125
+ text: "Cameroon",
126
+ picture: "http://flags.fmcdn.net/data/flags/mini/cm.png" },
127
+ { id: "ca",
128
+ text: "Canada",
129
+ picture: "http://flags.fmcdn.net/data/flags/mini/ca.png" },
130
+ { id: "cv",
131
+ text: "Cape Verde",
132
+ picture: "http://flags.fmcdn.net/data/flags/mini/cv.png" },
133
+ { id: "cf",
134
+ text: "Central African Republic",
135
+ picture: "http://flags.fmcdn.net/data/flags/mini/cf.png" },
136
+ { id: "td",
137
+ text: "Chad",
138
+ picture: "http://flags.fmcdn.net/data/flags/mini/td.png" },
139
+ { id: "cl",
140
+ text: "Chile",
141
+ picture: "http://flags.fmcdn.net/data/flags/mini/cl.png" },
142
+ { id: "co",
143
+ text: "Colombia",
144
+ picture: "http://flags.fmcdn.net/data/flags/mini/co.png" },
145
+ { id: "km",
146
+ text: "Comoros",
147
+ picture: "http://flags.fmcdn.net/data/flags/mini/km.png" },
148
+ { id: "ck",
149
+ text: "the Cook Islands",
150
+ picture: "http://flags.fmcdn.net/data/flags/mini/ck.png" },
151
+ { id: "cr",
152
+ text: "Costa Rica",
153
+ picture: "http://flags.fmcdn.net/data/flags/mini/cr.png" },
154
+ { id: "ci",
155
+ text: "Cote d'Ivoire",
156
+ picture: "http://flags.fmcdn.net/data/flags/mini/ci.png" },
157
+ { id: "hr",
158
+ text: "Croatia",
159
+ picture: "http://flags.fmcdn.net/data/flags/mini/hr.png" },
160
+ { id: "cu",
161
+ text: "Cuba",
162
+ picture: "http://flags.fmcdn.net/data/flags/mini/cu.png" },
163
+ { id: "cy",
164
+ text: "Cyprus",
165
+ picture: "http://flags.fmcdn.net/data/flags/mini/cy.png" },
166
+ { id: "cz",
167
+ text: "Czech Republic",
168
+ picture: "http://flags.fmcdn.net/data/flags/mini/cz.png" },
169
+ { id: "gs",
170
+ text: "Democratic Republic of the Congo",
171
+ picture: "http://flags.fmcdn.net/data/flags/mini" },
172
+ { id: "dk",
173
+ text: "Denmark",
174
+ picture: "http://flags.fmcdn.net/data/flags/mini/dk.png" },
175
+ { id: "dj",
176
+ text: "Djibouti",
177
+ picture: "http://flags.fmcdn.net/data/flags/mini/dj.png" },
178
+ { id: "dm",
179
+ text: "Dominica",
180
+ picture: "http://flags.fmcdn.net/data/flags/mini/dm.png" },
181
+ { id: "do",
182
+ text: "Dominican Republic",
183
+ picture: "http://flags.fmcdn.net/data/flags/mini/do.png" },
184
+ { id: "tl",
185
+ text: "East Timor",
186
+ picture: "http://flags.fmcdn.net/data/flags/mini/tl.png" },
187
+ { id: "ec",
188
+ text: "Ecuador",
189
+ picture: "http://flags.fmcdn.net/data/flags/mini/ec.png" },
190
+ { id: "eg",
191
+ text: "Egypt",
192
+ picture: "http://flags.fmcdn.net/data/flags/mini/eg.png" },
193
+ { id: "sv",
194
+ text: "El Salvador",
195
+ picture: "http://flags.fmcdn.net/data/flags/mini/sv.png" },
196
+ { id: "gq",
197
+ text: "Equatorial Guinea",
198
+ picture: "http://flags.fmcdn.net/data/flags/mini/gq.png" },
199
+ { id: "er",
200
+ text: "Eritrea",
201
+ picture: "http://flags.fmcdn.net/data/flags/mini/er.png" },
202
+ { id: "ee",
203
+ text: "Estonia",
204
+ picture: "http://flags.fmcdn.net/data/flags/mini/ee.png" },
205
+ { id: "et",
206
+ text: "Ethiopia",
207
+ picture: "http://flags.fmcdn.net/data/flags/mini/et.png" },
208
+ { id: "fj",
209
+ text: "Fiji",
210
+ picture: "http://flags.fmcdn.net/data/flags/mini/fj.png" },
211
+ { id: "fi",
212
+ text: "Finland",
213
+ picture: "http://flags.fmcdn.net/data/flags/mini/fi.png" },
214
+ { id: "fr",
215
+ text: "France",
216
+ picture: "http://flags.fmcdn.net/data/flags/mini/fr.png" },
217
+ { id: "ga",
218
+ text: "Gabon",
219
+ picture: "http://flags.fmcdn.net/data/flags/mini/ga.png" },
220
+ { id: "gm",
221
+ text: "Gambia",
222
+ picture: "http://flags.fmcdn.net/data/flags/mini/gm.png" },
223
+ { id: "ge",
224
+ text: "Georgia",
225
+ picture: "http://flags.fmcdn.net/data/flags/mini/ge.png" },
226
+ { id: "de",
227
+ text: "Germany",
228
+ picture: "http://flags.fmcdn.net/data/flags/mini/de.png" },
229
+ { id: "gh",
230
+ text: "Ghana",
231
+ picture: "http://flags.fmcdn.net/data/flags/mini/gh.png" },
232
+ { id: "gr",
233
+ text: "Greece",
234
+ picture: "http://flags.fmcdn.net/data/flags/mini/gr.png" },
235
+ { id: "gd",
236
+ text: "Grenada",
237
+ picture: "http://flags.fmcdn.net/data/flags/mini/gd.png" },
238
+ { id: "gt",
239
+ text: "Guatemala",
240
+ picture: "http://flags.fmcdn.net/data/flags/mini/gt.png" },
241
+ { id: "gn",
242
+ text: "Guinea",
243
+ picture: "http://flags.fmcdn.net/data/flags/mini/gn.png" },
244
+ { id: "gw",
245
+ text: "Guinea-Bissau",
246
+ picture: "http://flags.fmcdn.net/data/flags/mini/gw.png" },
247
+ { id: "gy",
248
+ text: "Guyana",
249
+ picture: "http://flags.fmcdn.net/data/flags/mini/gy.png" },
250
+ { id: "ht",
251
+ text: "Haiti",
252
+ picture: "http://flags.fmcdn.net/data/flags/mini/ht.png" },
253
+ { id: "hn",
254
+ text: "Honduras",
255
+ picture: "http://flags.fmcdn.net/data/flags/mini/hn.png" },
256
+ { id: "hu",
257
+ text: "Hungary",
258
+ picture: "http://flags.fmcdn.net/data/flags/mini/hu.png" },
259
+ { id: "is",
260
+ text: "Iceland",
261
+ picture: "http://flags.fmcdn.net/data/flags/mini/is.png" },
262
+ { id: "in",
263
+ text: "India",
264
+ picture: "http://flags.fmcdn.net/data/flags/mini/in.png" },
265
+ { id: "id",
266
+ text: "Indonesia",
267
+ picture: "http://flags.fmcdn.net/data/flags/mini/id.png" },
268
+ { id: "ir",
269
+ text: "Iran",
270
+ picture: "http://flags.fmcdn.net/data/flags/mini/ir.png" },
271
+ { id: "iq",
272
+ text: "Iraq",
273
+ picture: "http://flags.fmcdn.net/data/flags/mini/iq.png" },
274
+ { id: "ie",
275
+ text: "Ireland",
276
+ picture: "http://flags.fmcdn.net/data/flags/mini/ie.png" },
277
+ { id: "il",
278
+ text: "Israel",
279
+ picture: "http://flags.fmcdn.net/data/flags/mini/il.png" },
280
+ { id: "it",
281
+ text: "Italy",
282
+ picture: "http://flags.fmcdn.net/data/flags/mini/it.png" },
283
+ { id: "jm",
284
+ text: "Jamaica",
285
+ picture: "http://flags.fmcdn.net/data/flags/mini/jm.png" },
286
+ { id: "jp",
287
+ text: "Japan",
288
+ picture: "http://flags.fmcdn.net/data/flags/mini/jp.png" },
289
+ { id: "jo",
290
+ text: "Jordan",
291
+ picture: "http://flags.fmcdn.net/data/flags/mini/jo.png" },
292
+ { id: "kz",
293
+ text: "Kazakhstan",
294
+ picture: "http://flags.fmcdn.net/data/flags/mini/kz.png" },
295
+ { id: "ke",
296
+ text: "Kenya",
297
+ picture: "http://flags.fmcdn.net/data/flags/mini/ke.png" },
298
+ { id: "ki",
299
+ text: "Kiribati",
300
+ picture: "http://flags.fmcdn.net/data/flags/mini/ki.png" },
301
+ { id: "ks",
302
+ text: "Kosovo",
303
+ picture: "http://flags.fmcdn.net/data/flags/mini/ks.png" },
304
+ { id: "kw",
305
+ text: "Kuwait",
306
+ picture: "http://flags.fmcdn.net/data/flags/mini/kw.png" },
307
+ { id: "kg",
308
+ text: "Kyrgyzstan",
309
+ picture: "http://flags.fmcdn.net/data/flags/mini/kg.png" },
310
+ { id: "la",
311
+ text: "Laos",
312
+ picture: "http://flags.fmcdn.net/data/flags/mini/la.png" },
313
+ { id: "lv",
314
+ text: "Latvia",
315
+ picture: "http://flags.fmcdn.net/data/flags/mini/lv.png" },
316
+ { id: "lb",
317
+ text: "Lebanon",
318
+ picture: "http://flags.fmcdn.net/data/flags/mini/lb.png" },
319
+ { id: "ls",
320
+ text: "Lesotho",
321
+ picture: "http://flags.fmcdn.net/data/flags/mini/ls.png" },
322
+ { id: "lr",
323
+ text: "Liberia",
324
+ picture: "http://flags.fmcdn.net/data/flags/mini/lr.png" },
325
+ { id: "ly",
326
+ text: "Libya",
327
+ picture: "http://flags.fmcdn.net/data/flags/mini/ly.png" },
328
+ { id: "li",
329
+ text: "Liechtenstein",
330
+ picture: "http://flags.fmcdn.net/data/flags/mini/li.png" },
331
+ { id: "lt",
332
+ text: "Lithuania",
333
+ picture: "http://flags.fmcdn.net/data/flags/mini/lt.png" },
334
+ { id: "lu",
335
+ text: "Luxembourg",
336
+ picture: "http://flags.fmcdn.net/data/flags/mini/lu.png" },
337
+ { id: "mk",
338
+ text: "Macedonia",
339
+ picture: "http://flags.fmcdn.net/data/flags/mini/mk.png" },
340
+ { id: "mg",
341
+ text: "Madagascar",
342
+ picture: "http://flags.fmcdn.net/data/flags/mini/mg.png" },
343
+ { id: "mw",
344
+ text: "Malawi",
345
+ picture: "http://flags.fmcdn.net/data/flags/mini/mw.png" },
346
+ { id: "my",
347
+ text: "Malaysia",
348
+ picture: "http://flags.fmcdn.net/data/flags/mini/my.png" },
349
+ { id: "mv",
350
+ text: "Maldives",
351
+ picture: "http://flags.fmcdn.net/data/flags/mini/mv.png" },
352
+ { id: "ml",
353
+ text: "Mali",
354
+ picture: "http://flags.fmcdn.net/data/flags/mini/ml.png" },
355
+ { id: "mt",
356
+ text: "Malta",
357
+ picture: "http://flags.fmcdn.net/data/flags/mini/mt.png" },
358
+ { id: "mh",
359
+ text: "Marshall Islands",
360
+ picture: "http://flags.fmcdn.net/data/flags/mini/mh.png" },
361
+ { id: "mr",
362
+ text: "Mauritania",
363
+ picture: "http://flags.fmcdn.net/data/flags/mini/mr.png" },
364
+ { id: "mu",
365
+ text: "Mauritius",
366
+ picture: "http://flags.fmcdn.net/data/flags/mini/mu.png" },
367
+ { id: "mx",
368
+ text: "Mexico",
369
+ picture: "http://flags.fmcdn.net/data/flags/mini/mx.png" },
370
+ { id: "fm",
371
+ text: "Micronesia",
372
+ picture: "http://flags.fmcdn.net/data/flags/mini/fm.png" },
373
+ { id: "md",
374
+ text: "Moldova",
375
+ picture: "http://flags.fmcdn.net/data/flags/mini/md.png" },
376
+ { id: "mc",
377
+ text: "Monaco",
378
+ picture: "http://flags.fmcdn.net/data/flags/mini/mc.png" },
379
+ { id: "mn",
380
+ text: "Mongolia",
381
+ picture: "http://flags.fmcdn.net/data/flags/mini/mn.png" },
382
+ { id: "me",
383
+ text: "Montenegro",
384
+ picture: "http://flags.fmcdn.net/data/flags/mini/me.png" },
385
+ { id: "ma",
386
+ text: "Morocco",
387
+ picture: "http://flags.fmcdn.net/data/flags/mini/ma.png" },
388
+ { id: "mz",
389
+ text: "Mozambique",
390
+ picture: "http://flags.fmcdn.net/data/flags/mini/mz.png" },
391
+ { id: "mm",
392
+ text: "Myanmar",
393
+ picture: "http://flags.fmcdn.net/data/flags/mini/mm.png" },
394
+ { id: "na",
395
+ text: "Namibia",
396
+ picture: "http://flags.fmcdn.net/data/flags/mini/na.png" },
397
+ { id: "nr",
398
+ text: "Nauru",
399
+ picture: "http://flags.fmcdn.net/data/flags/mini/nr.png" },
400
+ { id: "np",
401
+ text: "Nepal",
402
+ picture: "http://flags.fmcdn.net/data/flags/mini/np.png" },
403
+ { id: "nl",
404
+ text: "Netherlands",
405
+ picture: "http://flags.fmcdn.net/data/flags/mini/nl.png" },
406
+ { id: "nz",
407
+ text: "New Zealand",
408
+ picture: "http://flags.fmcdn.net/data/flags/mini/nz.png" },
409
+ { id: "ni",
410
+ text: "Nicaragua",
411
+ picture: "http://flags.fmcdn.net/data/flags/mini/ni.png" },
412
+ { id: "ne",
413
+ text: "Niger",
414
+ picture: "http://flags.fmcdn.net/data/flags/mini/ne.png" },
415
+ { id: "ng",
416
+ text: "Nigeria",
417
+ picture: "http://flags.fmcdn.net/data/flags/mini/ng.png" },
418
+ { id: "nu",
419
+ text: "Niue",
420
+ picture: "http://flags.fmcdn.net/data/flags/mini/nu.png" },
421
+ { id: "kp",
422
+ text: "North Korea",
423
+ picture: "http://flags.fmcdn.net/data/flags/mini/kp.png" },
424
+ { id: "no",
425
+ text: "Norway",
426
+ picture: "http://flags.fmcdn.net/data/flags/mini/no.png" },
427
+ { id: "om",
428
+ text: "Oman",
429
+ picture: "http://flags.fmcdn.net/data/flags/mini/om.png" },
430
+ { id: "pk",
431
+ text: "Pakistan",
432
+ picture: "http://flags.fmcdn.net/data/flags/mini/pk.png" },
433
+ { id: "pw",
434
+ text: "Palau",
435
+ picture: "http://flags.fmcdn.net/data/flags/mini/pw.png" },
436
+ { id: "pa",
437
+ text: "Panama",
438
+ picture: "http://flags.fmcdn.net/data/flags/mini/pa.png" },
439
+ { id: "pg",
440
+ text: "Papua New Guinea",
441
+ picture: "http://flags.fmcdn.net/data/flags/mini/pg.png" },
442
+ { id: "py",
443
+ text: "Paraguay",
444
+ picture: "http://flags.fmcdn.net/data/flags/mini/py.png" },
445
+ { id: "cn",
446
+ text: "People's Republic of China",
447
+ picture: "http://flags.fmcdn.net/data/flags/mini/cn.png" },
448
+ { id: "pe",
449
+ text: "Peru",
450
+ picture: "http://flags.fmcdn.net/data/flags/mini/pe.png" },
451
+ { id: "ph",
452
+ text: "Philippines",
453
+ picture: "http://flags.fmcdn.net/data/flags/mini/ph.png" },
454
+ { id: "pl",
455
+ text: "Poland",
456
+ picture: "http://flags.fmcdn.net/data/flags/mini/pl.png" },
457
+ { id: "pt",
458
+ text: "Portugal",
459
+ picture: "http://flags.fmcdn.net/data/flags/mini/pt.png" },
460
+ { id: "qa",
461
+ text: "Qatar",
462
+ picture: "http://flags.fmcdn.net/data/flags/mini/qa.png" },
463
+ { id: "tw",
464
+ text: "Republic of China",
465
+ picture: "http://flags.fmcdn.net/data/flags/mini/tw.png" },
466
+ { id: "cg",
467
+ text: "Republic of the Congo",
468
+ picture: "http://flags.fmcdn.net/data/flags/mini/cg.png" },
469
+ { id: "ro",
470
+ text: "Romania",
471
+ picture: "http://flags.fmcdn.net/data/flags/mini/ro.png" },
472
+ { id: "ru",
473
+ text: "Russia",
474
+ picture: "http://flags.fmcdn.net/data/flags/mini/ru.png" },
475
+ { id: "rw",
476
+ text: "Rwanda",
477
+ picture: "http://flags.fmcdn.net/data/flags/mini/rw.png" },
478
+ { id: "kn",
479
+ text: "Saint Kitts and Nevis",
480
+ picture: "http://flags.fmcdn.net/data/flags/mini/kn.png" },
481
+ { id: "lc",
482
+ text: "Saint Lucia",
483
+ picture: "http://flags.fmcdn.net/data/flags/mini/lc.png" },
484
+ { id: "ni",
485
+ text: "Saint Vincent and the Grenadines",
486
+ picture: "http://flags.fmcdn.net/data/flags/mini/vc" },
487
+ { id: "ws",
488
+ text: "Samoa",
489
+ picture: "http://flags.fmcdn.net/data/flags/mini/ws.png" },
490
+ { id: "sm",
491
+ text: "San Marino",
492
+ picture: "http://flags.fmcdn.net/data/flags/mini/sm.png" },
493
+ { id: "st",
494
+ text: "Sao Tome and Principe",
495
+ picture: "http://flags.fmcdn.net/data/flags/mini/st.png" },
496
+ { id: "sa",
497
+ text: "Saudi Arabia",
498
+ picture: "http://flags.fmcdn.net/data/flags/mini/sa.png" },
499
+ { id: "sn",
500
+ text: "Senegal",
501
+ picture: "http://flags.fmcdn.net/data/flags/mini/sn.png" },
502
+ { id: "rs",
503
+ text: "Serbia",
504
+ picture: "http://flags.fmcdn.net/data/flags/mini/rs.png" },
505
+ { id: "sc",
506
+ text: "Seychelles",
507
+ picture: "http://flags.fmcdn.net/data/flags/mini/sc.png" },
508
+ { id: "sl",
509
+ text: "Sierra Leone",
510
+ picture: "http://flags.fmcdn.net/data/flags/mini/sl.png" },
511
+ { id: "sg",
512
+ text: "Singapore",
513
+ picture: "http://flags.fmcdn.net/data/flags/mini/sg.png" },
514
+ { id: "sk",
515
+ text: "Slovakia",
516
+ picture: "http://flags.fmcdn.net/data/flags/mini/sk.png" },
517
+ { id: "si",
518
+ text: "Slovenia",
519
+ picture: "http://flags.fmcdn.net/data/flags/mini/si.png" },
520
+ { id: "sb",
521
+ text: "Solomon Islands",
522
+ picture: "http://flags.fmcdn.net/data/flags/mini/sb.png" },
523
+ { id: "so",
524
+ text: "Somalia",
525
+ picture: "http://flags.fmcdn.net/data/flags/mini/so.png" },
526
+ { id: "za",
527
+ text: "South Africa",
528
+ picture: "http://flags.fmcdn.net/data/flags/mini/za.png" },
529
+ { id: "kr",
530
+ text: "South Korea",
531
+ picture: "http://flags.fmcdn.net/data/flags/mini/kr.png" },
532
+ { id: "ss",
533
+ text: "South Sudan",
534
+ picture: "http://flags.fmcdn.net/data/flags/mini/ss.png" },
535
+ { id: "es",
536
+ text: "Spain",
537
+ picture: "http://flags.fmcdn.net/data/flags/mini/es.png" },
538
+ { id: "lk",
539
+ text: "Sri Lanka",
540
+ picture: "http://flags.fmcdn.net/data/flags/mini/lk.png" },
541
+ { id: "sd",
542
+ text: "Sudan",
543
+ picture: "http://flags.fmcdn.net/data/flags/mini/sd.png" },
544
+ { id: "sr",
545
+ text: "Suriname",
546
+ picture: "http://flags.fmcdn.net/data/flags/mini/sr.png" },
547
+ { id: "sz",
548
+ text: "Swaziland",
549
+ picture: "http://flags.fmcdn.net/data/flags/mini/sz.png" },
550
+ { id: "se",
551
+ text: "Sweden",
552
+ picture: "http://flags.fmcdn.net/data/flags/mini/se.png" },
553
+ { id: "ch",
554
+ text: "Switzerland",
555
+ picture: "http://flags.fmcdn.net/data/flags/mini/ch.png" },
556
+ { id: "sy",
557
+ text: "Syria",
558
+ picture: "http://flags.fmcdn.net/data/flags/mini/sy.png" },
559
+ { id: "tj",
560
+ text: "Tajikistan",
561
+ picture: "http://flags.fmcdn.net/data/flags/mini/tj.png" },
562
+ { id: "tz",
563
+ text: "Tanzania",
564
+ picture: "http://flags.fmcdn.net/data/flags/mini/tz.png" },
565
+ { id: "th",
566
+ text: "Thailand",
567
+ picture: "http://flags.fmcdn.net/data/flags/mini/th.png" },
568
+ { id: "tg",
569
+ text: "Togo",
570
+ picture: "http://flags.fmcdn.net/data/flags/mini/tg.png" },
571
+ { id: "to",
572
+ text: "Tonga",
573
+ picture: "http://flags.fmcdn.net/data/flags/mini/to.png" },
574
+ { id: "tt",
575
+ text: "Trinidad and Tobago",
576
+ picture: "http://flags.fmcdn.net/data/flags/mini/tt.png" },
577
+ { id: "tn",
578
+ text: "Tunisia",
579
+ picture: "http://flags.fmcdn.net/data/flags/mini/tn.png" },
580
+ { id: "tr",
581
+ text: "Turkey",
582
+ picture: "http://flags.fmcdn.net/data/flags/mini/tr.png" },
583
+ { id: "tm",
584
+ text: "Turkmenistan",
585
+ picture: "http://flags.fmcdn.net/data/flags/mini/tm.png" },
586
+ { id: "tv",
587
+ text: "Tuvalu",
588
+ picture: "http://flags.fmcdn.net/data/flags/mini/tv.png" },
589
+ { id: "ug",
590
+ text: "Uganda",
591
+ picture: "http://flags.fmcdn.net/data/flags/mini/ug.png" },
592
+ { id: "ua",
593
+ text: "Ukraine",
594
+ picture: "http://flags.fmcdn.net/data/flags/mini/ua.png" },
595
+ { id: "ae",
596
+ text: "United Arab Emirates",
597
+ picture: "http://flags.fmcdn.net/data/flags/mini/ae.png" },
598
+ { id: "gb",
599
+ text: "United Kingdom",
600
+ picture: "http://flags.fmcdn.net/data/flags/mini/gb.png" },
601
+ { id: "us",
602
+ text: "United States",
603
+ picture: "http://flags.fmcdn.net/data/flags/mini/us.png" },
604
+ { id: "uy",
605
+ text: "Uruguay",
606
+ picture: "http://flags.fmcdn.net/data/flags/mini/uy.png" },
607
+ { id: "uz",
608
+ text: "Uzbekistan",
609
+ picture: "http://flags.fmcdn.net/data/flags/mini/uz.png" },
610
+ { id: "vu",
611
+ text: "Vanuatu",
612
+ picture: "http://flags.fmcdn.net/data/flags/mini/vu.png" },
613
+ { id: "va",
614
+ text: "Vatican City",
615
+ picture: "http://flags.fmcdn.net/data/flags/mini/va.png" },
616
+ { id: "ve",
617
+ text: "Venezuela",
618
+ picture: "http://flags.fmcdn.net/data/flags/mini/ve.png" },
619
+ { id: "vn",
620
+ text: "Vietnam",
621
+ picture: "http://flags.fmcdn.net/data/flags/mini/vn.png" },
622
+ { id: "eh",
623
+ text: "Western Sahara",
624
+ picture: "http://flags.fmcdn.net/data/flags/mini/eh.png" },
625
+ { id: "ye",
626
+ text: "Yemen",
627
+ picture: "http://flags.fmcdn.net/data/flags/mini/ye.png" },
628
+ { id: "zm",
629
+ text: "Zambia",
630
+ picture: "http://flags.fmcdn.net/data/flags/mini/zm.png" },
631
+ { id: "zw",
632
+ text: "Zimbabwe",
633
+ picture: "http://flags.fmcdn.net/data/flags/mini/zw.png" }
634
+ ]
635
+
636
+ class UserFinder
637
+ def self.find(id)
638
+ USERS.find { |it| it[:id].to_s == id.to_s }[:id]
639
+ end
640
+
641
+ def self.find_by_ids(ids)
38
642
  USERS.select { |it| ids.include?(it[:id].to_s) }
39
643
  end
40
644
 
@@ -49,7 +653,34 @@ class User
49
653
  end
50
654
  end
51
655
 
52
- RolloutUi2.wrap(Rollout.new(Redis.new)).with_finder(User)
656
+ class CountryFinder
657
+ def self.find(id)
658
+ COUNTRIES.find { |it| it[:id].to_s.downcase == id.to_s.downcase }[:id]
659
+ end
660
+
661
+ def self.find_by_ids(ids)
662
+ COUNTRIES.select { |it| ids.include?(it[:id].to_s.downcase) }
663
+ end
664
+
665
+ def self.search(query, page)
666
+ result = COUNTRIES.select { |it| %r{#{query.downcase}} =~ it[:text].downcase }
667
+ per_page = 3
668
+ {
669
+ results: result[(page-1) * per_page...page * per_page],
670
+ per_page: per_page,
671
+ total_count: result.count
672
+ }
673
+ end
674
+ end
675
+
676
+
677
+ redis_connection = Redis.new
678
+
679
+ rollout_user = Rollout.new(Redis::Namespace.new(:user, redis: redis_connection))
680
+ rollout_country = Rollout.new(Redis::Namespace.new(:country, redis: redis_connection))
681
+
682
+ RolloutUi2.wrap(rollout_user, finder: UserFinder, key: :user)
683
+ RolloutUi2.wrap(rollout_country, finder: CountryFinder, key: :country)
53
684
 
54
685
  RolloutUi2::Server.use Rack::Auth::Basic do |user, pass|
55
686
  user == pass
data/lib/rollout_ui2.rb CHANGED
@@ -4,54 +4,54 @@ require 'yaml'
4
4
 
5
5
  module RolloutUi2
6
6
  class << self
7
- def with_finder(finder)
8
- @finder = finder
7
+ attr_reader :rollouts
8
+ attr_reader :finderss
9
+
10
+ def with_finder(finder, key: :default)
11
+ @finders ||= { default: finder }
12
+ @finders[key] = finder
9
13
  self
10
14
  end
11
15
 
12
- def finder
13
- @finder
16
+ def wrap(rollout, key: :default, finder: nil)
17
+ @rollouts ||= { default: rollout }
18
+ @rollouts[key] = rollout
19
+ with_finder(finder, key: key) if finder
20
+ self
14
21
  end
15
22
 
16
- def wrap(rollout)
17
- @rollout = rollout
18
- self
23
+ def rollout(key = :default)
24
+ @rollouts[key]
19
25
  end
20
26
 
21
- def store
22
- @store ||= begin
23
- require 'redis'
24
- Redis.new
25
- end
27
+ def finder(key = :default)
28
+ @finders[key] if @finders
26
29
  end
27
30
 
28
- def rollout
29
- @rollout ||= begin
30
- require 'rollout'
31
- Rollout.new(store)
32
- end
31
+ def index(key = :default)
32
+ rollout(key).features.empty? ? [] : multi(rollout(key).features.sort, rollout(key))
33
33
  end
34
34
 
35
- def index
36
- rollout.features.empty? ? [] : multi(rollout.features.sort)
35
+ def get(name, key = :default)
36
+ Feature.new(rollout(key).get(name))
37
37
  end
38
38
 
39
- def get(name)
40
- Feature.new(rollout.get(name))
39
+ def save(feature, key = :default)
40
+ rollout(key).send(:save, feature)
41
41
  end
42
42
 
43
- def save(feature)
44
- rollout.send(:save, feature)
43
+ def delete(feature, key = :default)
44
+ return rollout(key).delete(feature.name) if rollout(key).respond_to?(:delete)
45
+ rollout(key).deactivate(feature.name)
45
46
  end
46
47
 
47
- def delete(feature)
48
- return rollout.delete(feature.name) if rollout.respond_to?(:delete)
49
- rollout.deactivate(feature.name)
48
+ def keys
49
+ @rollouts.keys.reject { |i| i == :default}
50
50
  end
51
51
 
52
52
  private
53
53
 
54
- def multi(keys)
54
+ def multi(keys, rollout)
55
55
  features = if rollout.respond_to?(:multi_get)
56
56
  rollout.multi_get(*keys)
57
57
  else
@@ -87,13 +87,13 @@ module RolloutUi2
87
87
  return unless user && user != ""
88
88
  case key
89
89
  when :any
90
- feature.active?(RolloutUi2.rollout, current_user)
90
+ feature.active?(current_rollout, current_user)
91
91
  when :percentage
92
92
  feature.feature.send(:user_in_percentage?, user) rescue nil
93
93
  when :user
94
94
  feature.feature.send(:user_in_active_users?, user) rescue nil
95
95
  when :group
96
- feature.feature.send(:user_in_active_group?, current_user, RolloutUi2.rollout) rescue nil
96
+ feature.feature.send(:user_in_active_group?, current_user, current_rollout) rescue nil
97
97
  end && yield || nil
98
98
  end
99
99
 
@@ -103,14 +103,26 @@ module RolloutUi2
103
103
 
104
104
  def current_user
105
105
  @_current_user ||= if users_provided?
106
- RolloutUi2.finder.find(user)
106
+ current_finder.find(user)
107
107
  else
108
108
  user
109
109
  end
110
110
  end
111
111
 
112
+ def current_key
113
+ (params[:key] || :default).to_sym
114
+ end
115
+
116
+ def current_rollout
117
+ RolloutUi2.rollout(current_key)
118
+ end
119
+
120
+ def current_finder
121
+ RolloutUi2.finder(current_key)
122
+ end
123
+
112
124
  def all_groups(features)
113
- defined_groups = RolloutUi2.rollout.instance_eval("@groups").keys rescue []
125
+ defined_groups = current_rollout.instance_eval("@groups").keys rescue []
114
126
  defined_groups | features.reduce([]) { |a, e| a | e.groups }
115
127
  end
116
128
 
@@ -143,46 +155,44 @@ module RolloutUi2
143
155
 
144
156
  def users_2_select2(users)
145
157
  return users unless users_provided?
146
- RolloutUi2
147
- .finder
158
+ current_finder
148
159
  .find_by_ids(Array(users))
149
160
  .map { |it| it.merge!(selected: true, placeholder: it[:text]) }
150
161
  .to_json
151
162
  end
152
163
 
153
164
  def users_provided?
154
- !RolloutUi2.finder.nil?
165
+ !current_finder.nil?
155
166
  end
156
167
  end
157
168
 
158
169
  get '/users' do
159
170
  return status 404 unless users_provided?
160
- RolloutUi2
161
- .finder
171
+ current_finder
162
172
  .search(params["q"], (params["page"] || 1).to_i)
163
173
  .to_json
164
174
  end
165
175
 
166
176
  get '/' do
167
- @features = RolloutUi2.index
177
+ @features = RolloutUi2.index(current_key)
168
178
  @groups = all_groups(@features)
169
179
  erb :index
170
180
  end
171
181
 
172
182
  post '/' do
173
- feature = RolloutUi2.get(params["name"])
183
+ feature = RolloutUi2.get(params["name"], current_key)
174
184
 
175
185
  case params["action"]
176
186
  when "new"
177
- RolloutUi2.save(feature)
187
+ RolloutUi2.save(feature, current_key)
178
188
  when "delete"
179
- RolloutUi2.delete(feature)
189
+ RolloutUi2.delete(feature, current_key)
180
190
  when "update"
181
191
  feature.percentage = params["percentage"].to_f
182
192
  feature.groups = as_array(params["groups"])
183
193
  feature.users = as_array(params["users"])
184
194
 
185
- RolloutUi2.save(feature)
195
+ RolloutUi2.save(feature, current_key)
186
196
  end
187
197
 
188
198
  redirect to("#{request.path_info}?#{request.query_string}")
@@ -1,3 +1,3 @@
1
1
  module RolloutUi2
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/views/layout.erb CHANGED
@@ -61,12 +61,22 @@
61
61
  <body>
62
62
  <nav class="navbar navbar-default">
63
63
  <div class="container">
64
- <div class="row">
65
- <div class="navbar-header"><a class="navbar-brand" href="/">RolloutUi2</a></div>
66
- <form method="get">
67
- <div class="col-sm-6 col-sm-offset-4" style="top:7px">
64
+ <!-- <div class="row"> -->
65
+ <div class="navbar-header"><a class="navbar-brand" href="?">RolloutUi2</a></div>
66
+
67
+ <ul class="nav navbar-nav col-sm-6">
68
+ <% RolloutUi2.keys.each do |key| %>
69
+ <li class="<%= "active" if key == current_key %>">
70
+ <a href="?key=<%= key %>"><%= key %></a>
71
+ </li>
72
+ <% end %>
73
+ </ul>
74
+
75
+ <form method="get" style="display: inline">
76
+ <div class="col-sm-4 pull-right" style="top:7px">
68
77
  <div class="form-group">
69
78
  <div class="input-group select2-bootstrap-append">
79
+ <input type="hidden" name="key" value="<%= current_key %>">
70
80
  <% if users_provided? %>
71
81
  <select
72
82
  data-tags="true"
@@ -90,7 +100,7 @@
90
100
  </div>
91
101
  </div>
92
102
  </form>
93
- </div>
103
+ <!-- </div> -->
94
104
  </div><!-- /.container-fluid -->
95
105
  </nav>
96
106
  <main class="container main">
@@ -114,14 +124,21 @@
114
124
 
115
125
  $("select.user-api").select2({
116
126
  ajax: {
117
- url: "<%= u 'users' %>",
127
+ url: "<%= u "users?key=#{current_key}" %>",
118
128
  dataType: 'json',
119
129
  delay: 250,
120
130
  data: function (params) {
131
+ console.log("data")
132
+ console.log(params)
133
+ console.log({ q: params.term, page: params.page })
121
134
  return { q: params.term, page: params.page };
122
135
  },
123
136
  processResults: function (data, params) {
137
+ console.log("processResults")
138
+ console.log(data)
139
+ console.log(params)
124
140
  params.page = params.page || 1;
141
+ console.log({ more: (params.page * data.per_page) < data.total_count })
125
142
  return {
126
143
  results: data.results,
127
144
  pagination: { more: (params.page * data.per_page) < data.total_count }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollout_ui2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-13 00:00:00.000000000 Z
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler