detour 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +2 -25
- data/app/assets/javascripts/detour/add_fields.js +7 -0
- data/app/assets/javascripts/detour/delete_feature.js +9 -11
- data/app/assets/javascripts/detour/delete_flag.js +9 -11
- data/app/assets/javascripts/detour/delete_group.js +5 -0
- data/app/assets/javascripts/detour/feature_lines.js +23 -0
- data/app/assets/javascripts/detour/modals.js +1 -0
- data/app/assets/stylesheets/detour/main.css +12 -0
- data/app/controllers/detour/features_controller.rb +3 -2
- data/app/controllers/detour/flaggable_flags_controller.rb +9 -77
- data/app/controllers/detour/groups_controller.rb +39 -0
- data/app/helpers/detour/application_helper.rb +11 -0
- data/app/helpers/detour/flaggable_flags_helper.rb +20 -0
- data/app/helpers/detour/flags_helper.rb +5 -1
- data/app/models/detour/concerns/keepable.rb +21 -0
- data/app/models/detour/concerns/matchers.rb +28 -9
- data/app/models/detour/database_group_flag.rb +30 -0
- data/app/models/detour/defined_group.rb +21 -0
- data/app/models/detour/defined_group_flag.rb +28 -0
- data/app/models/detour/feature.rb +4 -3
- data/app/models/detour/flag_in_flag.rb +1 -8
- data/app/models/detour/flaggable_flag.rb +24 -0
- data/app/models/detour/group.rb +17 -0
- data/app/models/detour/membership.rb +41 -0
- data/app/models/detour/opt_out_flag.rb +1 -8
- data/app/views/detour/flaggable_flags/_flaggable_flag_fields.html.erb +19 -0
- data/app/views/detour/flaggable_flags/index.html.erb +13 -26
- data/app/views/detour/flags/_feature_form.html.erb +12 -3
- data/app/views/detour/flags/index.html.erb +7 -2
- data/app/views/detour/groups/_group.html.erb +3 -0
- data/app/views/detour/groups/_membership_fields.html.erb +19 -0
- data/app/views/detour/groups/index.html.erb +21 -0
- data/app/views/detour/groups/show.html.erb +41 -0
- data/app/views/detour/memberships/_membership.html.erb +4 -0
- data/app/views/detour/{features → shared}/_errors.html.erb +2 -2
- data/app/views/detour/shared/_nav.html.erb +1 -0
- data/app/views/detour/shared/error.js.erb +5 -0
- data/config/locales/en.yml +11 -0
- data/config/routes.rb +8 -7
- data/detour.gemspec +1 -0
- data/lib/detour/acts_as_flaggable.rb +19 -4
- data/lib/detour/configuration.rb +1 -1
- data/lib/detour/flag_form.rb +53 -34
- data/lib/detour/flaggable.rb +0 -19
- data/lib/detour/version.rb +1 -1
- data/lib/generators/templates/migration.rb +21 -1
- data/lib/tasks/.gitkeep +0 -0
- data/spec/controllers/detour/flaggable_flags_controller_spec.rb +30 -67
- data/spec/controllers/detour/groups_controller_spec.rb +107 -0
- data/spec/dummy/db/migrate/20131221052201_setup_detour.rb +21 -1
- data/spec/dummy/db/schema.rb +20 -1
- data/spec/factories/database_group_flag.rb +7 -0
- data/spec/factories/{group_flag.rb → defined_group_flag.rb} +1 -1
- data/spec/factories/group.rb +10 -0
- data/spec/factories/membership.rb +6 -0
- data/spec/features/database_group_flags_spec.rb +50 -0
- data/spec/features/database_groups_spec.rb +174 -0
- data/spec/features/defined_group_flags_spec.rb +67 -0
- data/spec/features/features_spec.rb +44 -0
- data/spec/features/flag_in_flags_spec.rb +22 -60
- data/spec/features/opt_out_flags_spec.rb +34 -59
- data/spec/integration/group_rollout_spec.rb +2 -2
- data/spec/lib/detour/acts_as_flaggable_spec.rb +12 -3
- data/spec/lib/detour/configuration_spec.rb +6 -2
- data/spec/lib/detour/flag_form_spec.rb +0 -11
- data/spec/lib/detour/flaggable_spec.rb +1 -54
- data/spec/models/detour/database_group_flag_spec.rb +29 -0
- data/spec/models/detour/defined_group_spec.rb +21 -0
- data/spec/models/detour/feature_spec.rb +57 -119
- data/spec/models/detour/flag_in_flag_spec.rb +1 -4
- data/spec/models/detour/flaggable_flag_spec.rb +25 -0
- data/spec/models/detour/group_flag_spec.rb +1 -1
- data/spec/models/detour/membership_spec.rb +58 -0
- data/spec/models/detour/opt_out_flag_spec.rb +1 -4
- data/spec/spec_helper.rb +4 -0
- metadata +97 -81
- data/app/models/detour/concerns/flag_actions.rb +0 -141
- data/app/models/detour/group_flag.rb +0 -13
- data/app/views/detour/features/_success.html.erb +0 -1
- data/app/views/detour/features/error.js.erb +0 -5
- data/lib/tasks/detour.rake +0 -119
- data/spec/features/group_flags_spec.rb +0 -49
- data/spec/integration/flag_rollout_spec.rb +0 -27
- data/spec/lib/tasks/detour_spec.rb +0 -162
- /data/app/views/detour/{features → shared}/success.js.erb +0 -0
metadata
CHANGED
@@ -1,218 +1,207 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: detour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jonathan Clem
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-02-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.2'
|
22
|
-
- -
|
20
|
+
- - ">="
|
23
21
|
- !ruby/object:Gem::Version
|
24
22
|
version: 3.2.16
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
|
-
- - ~>
|
27
|
+
- - "~>"
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '3.2'
|
33
|
-
- -
|
30
|
+
- - ">="
|
34
31
|
- !ruby/object:Gem::Version
|
35
32
|
version: 3.2.16
|
36
33
|
- !ruby/object:Gem::Dependency
|
37
34
|
name: indefinite_article
|
38
35
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
36
|
requirements:
|
41
|
-
- - ~>
|
37
|
+
- - "~>"
|
42
38
|
- !ruby/object:Gem::Version
|
43
39
|
version: '0.2'
|
44
|
-
- -
|
40
|
+
- - ">="
|
45
41
|
- !ruby/object:Gem::Version
|
46
42
|
version: 0.2.0
|
47
43
|
type: :runtime
|
48
44
|
prerelease: false
|
49
45
|
version_requirements: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
46
|
requirements:
|
52
|
-
- - ~>
|
47
|
+
- - "~>"
|
53
48
|
- !ruby/object:Gem::Version
|
54
49
|
version: '0.2'
|
55
|
-
- -
|
50
|
+
- - ">="
|
56
51
|
- !ruby/object:Gem::Version
|
57
52
|
version: 0.2.0
|
58
53
|
- !ruby/object:Gem::Dependency
|
59
54
|
name: capybara
|
60
55
|
requirement: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
56
|
requirements:
|
63
|
-
- -
|
57
|
+
- - ">="
|
64
58
|
- !ruby/object:Gem::Version
|
65
59
|
version: '0'
|
66
60
|
type: :development
|
67
61
|
prerelease: false
|
68
62
|
version_requirements: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
63
|
requirements:
|
71
|
-
- -
|
64
|
+
- - ">="
|
72
65
|
- !ruby/object:Gem::Version
|
73
66
|
version: '0'
|
74
67
|
- !ruby/object:Gem::Dependency
|
75
68
|
name: database_cleaner
|
76
69
|
requirement: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
70
|
requirements:
|
79
|
-
- - ~>
|
71
|
+
- - "~>"
|
80
72
|
- !ruby/object:Gem::Version
|
81
73
|
version: 1.2.0
|
82
74
|
type: :development
|
83
75
|
prerelease: false
|
84
76
|
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
77
|
requirements:
|
87
|
-
- - ~>
|
78
|
+
- - "~>"
|
88
79
|
- !ruby/object:Gem::Version
|
89
80
|
version: 1.2.0
|
90
81
|
- !ruby/object:Gem::Dependency
|
91
82
|
name: factory_girl_rails
|
92
83
|
requirement: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
84
|
requirements:
|
95
|
-
- -
|
85
|
+
- - ">="
|
96
86
|
- !ruby/object:Gem::Version
|
97
87
|
version: '0'
|
98
88
|
type: :development
|
99
89
|
prerelease: false
|
100
90
|
version_requirements: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
91
|
requirements:
|
103
|
-
- -
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: launchy
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
104
107
|
- !ruby/object:Gem::Version
|
105
108
|
version: '0'
|
106
109
|
- !ruby/object:Gem::Dependency
|
107
110
|
name: poltergeist
|
108
111
|
requirement: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
112
|
requirements:
|
111
|
-
- -
|
113
|
+
- - ">="
|
112
114
|
- !ruby/object:Gem::Version
|
113
115
|
version: '0'
|
114
116
|
type: :development
|
115
117
|
prerelease: false
|
116
118
|
version_requirements: !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
119
|
requirements:
|
119
|
-
- -
|
120
|
+
- - ">="
|
120
121
|
- !ruby/object:Gem::Version
|
121
122
|
version: '0'
|
122
123
|
- !ruby/object:Gem::Dependency
|
123
124
|
name: pry-nav
|
124
125
|
requirement: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
126
|
requirements:
|
127
|
-
- -
|
127
|
+
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
type: :development
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
133
|
requirements:
|
135
|
-
- -
|
134
|
+
- - ">="
|
136
135
|
- !ruby/object:Gem::Version
|
137
136
|
version: '0'
|
138
137
|
- !ruby/object:Gem::Dependency
|
139
138
|
name: rspec-rails
|
140
139
|
requirement: !ruby/object:Gem::Requirement
|
141
|
-
none: false
|
142
140
|
requirements:
|
143
|
-
- -
|
141
|
+
- - ">="
|
144
142
|
- !ruby/object:Gem::Version
|
145
143
|
version: '0'
|
146
144
|
type: :development
|
147
145
|
prerelease: false
|
148
146
|
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
none: false
|
150
147
|
requirements:
|
151
|
-
- -
|
148
|
+
- - ">="
|
152
149
|
- !ruby/object:Gem::Version
|
153
150
|
version: '0'
|
154
151
|
- !ruby/object:Gem::Dependency
|
155
152
|
name: selenium-webdriver
|
156
153
|
requirement: !ruby/object:Gem::Requirement
|
157
|
-
none: false
|
158
154
|
requirements:
|
159
|
-
- -
|
155
|
+
- - ">="
|
160
156
|
- !ruby/object:Gem::Version
|
161
157
|
version: '0'
|
162
158
|
type: :development
|
163
159
|
prerelease: false
|
164
160
|
version_requirements: !ruby/object:Gem::Requirement
|
165
|
-
none: false
|
166
161
|
requirements:
|
167
|
-
- -
|
162
|
+
- - ">="
|
168
163
|
- !ruby/object:Gem::Version
|
169
164
|
version: '0'
|
170
165
|
- !ruby/object:Gem::Dependency
|
171
166
|
name: shoulda-matchers
|
172
167
|
requirement: !ruby/object:Gem::Requirement
|
173
|
-
none: false
|
174
168
|
requirements:
|
175
|
-
- -
|
169
|
+
- - ">="
|
176
170
|
- !ruby/object:Gem::Version
|
177
171
|
version: '0'
|
178
172
|
type: :development
|
179
173
|
prerelease: false
|
180
174
|
version_requirements: !ruby/object:Gem::Requirement
|
181
|
-
none: false
|
182
175
|
requirements:
|
183
|
-
- -
|
176
|
+
- - ">="
|
184
177
|
- !ruby/object:Gem::Version
|
185
178
|
version: '0'
|
186
179
|
- !ruby/object:Gem::Dependency
|
187
180
|
name: sqlite3-ruby
|
188
181
|
requirement: !ruby/object:Gem::Requirement
|
189
|
-
none: false
|
190
182
|
requirements:
|
191
|
-
- -
|
183
|
+
- - ">="
|
192
184
|
- !ruby/object:Gem::Version
|
193
185
|
version: '0'
|
194
186
|
type: :development
|
195
187
|
prerelease: false
|
196
188
|
version_requirements: !ruby/object:Gem::Requirement
|
197
|
-
none: false
|
198
189
|
requirements:
|
199
|
-
- -
|
190
|
+
- - ">="
|
200
191
|
- !ruby/object:Gem::Version
|
201
192
|
version: '0'
|
202
193
|
- !ruby/object:Gem::Dependency
|
203
194
|
name: yard
|
204
195
|
requirement: !ruby/object:Gem::Requirement
|
205
|
-
none: false
|
206
196
|
requirements:
|
207
|
-
- -
|
197
|
+
- - ">="
|
208
198
|
- !ruby/object:Gem::Version
|
209
199
|
version: '0'
|
210
200
|
type: :development
|
211
201
|
prerelease: false
|
212
202
|
version_requirements: !ruby/object:Gem::Requirement
|
213
|
-
none: false
|
214
203
|
requirements:
|
215
|
-
- -
|
204
|
+
- - ">="
|
216
205
|
- !ruby/object:Gem::Version
|
217
206
|
version: '0'
|
218
207
|
description: Rollouts (feature flags) for Rails.
|
@@ -222,8 +211,8 @@ executables: []
|
|
222
211
|
extensions: []
|
223
212
|
extra_rdoc_files: []
|
224
213
|
files:
|
225
|
-
- .gitignore
|
226
|
-
- .travis.yml
|
214
|
+
- ".gitignore"
|
215
|
+
- ".travis.yml"
|
227
216
|
- Gemfile
|
228
217
|
- LICENSE.txt
|
229
218
|
- README.md
|
@@ -234,10 +223,13 @@ files:
|
|
234
223
|
- app/assets/fonts/glyphicons-halflings-regular.ttf
|
235
224
|
- app/assets/fonts/glyphicons-halflings-regular.woff
|
236
225
|
- app/assets/images/detour/.gitkeep
|
226
|
+
- app/assets/javascripts/detour/add_fields.js
|
237
227
|
- app/assets/javascripts/detour/application.js
|
238
228
|
- app/assets/javascripts/detour/bootstrap.js
|
239
229
|
- app/assets/javascripts/detour/delete_feature.js
|
240
230
|
- app/assets/javascripts/detour/delete_flag.js
|
231
|
+
- app/assets/javascripts/detour/delete_group.js
|
232
|
+
- app/assets/javascripts/detour/feature_lines.js
|
241
233
|
- app/assets/javascripts/detour/modals.js
|
242
234
|
- app/assets/javascripts/detour/tooltips.js
|
243
235
|
- app/assets/stylesheets/detour/application.css
|
@@ -247,33 +239,45 @@ files:
|
|
247
239
|
- app/controllers/detour/features_controller.rb
|
248
240
|
- app/controllers/detour/flaggable_flags_controller.rb
|
249
241
|
- app/controllers/detour/flags_controller.rb
|
242
|
+
- app/controllers/detour/groups_controller.rb
|
250
243
|
- app/helpers/detour/application_helper.rb
|
251
244
|
- app/helpers/detour/flaggable_flags_helper.rb
|
252
245
|
- app/helpers/detour/flags_helper.rb
|
253
246
|
- app/models/detour/concerns/countable_flag.rb
|
254
|
-
- app/models/detour/concerns/
|
247
|
+
- app/models/detour/concerns/keepable.rb
|
255
248
|
- app/models/detour/concerns/matchers.rb
|
249
|
+
- app/models/detour/database_group_flag.rb
|
250
|
+
- app/models/detour/defined_group.rb
|
251
|
+
- app/models/detour/defined_group_flag.rb
|
256
252
|
- app/models/detour/feature.rb
|
257
253
|
- app/models/detour/flag.rb
|
258
254
|
- app/models/detour/flag_in_flag.rb
|
259
|
-
- app/models/detour/
|
255
|
+
- app/models/detour/flaggable_flag.rb
|
256
|
+
- app/models/detour/group.rb
|
257
|
+
- app/models/detour/membership.rb
|
260
258
|
- app/models/detour/opt_out_flag.rb
|
261
259
|
- app/models/detour/percentage_flag.rb
|
262
260
|
- app/views/detour/application/index.html.erb
|
263
|
-
- app/views/detour/features/_errors.html.erb
|
264
|
-
- app/views/detour/features/_success.html.erb
|
265
|
-
- app/views/detour/features/error.js.erb
|
266
|
-
- app/views/detour/features/success.js.erb
|
267
261
|
- app/views/detour/flaggable_flags/_errors.html.erb
|
268
262
|
- app/views/detour/flaggable_flags/_flaggable_flag.html.erb
|
263
|
+
- app/views/detour/flaggable_flags/_flaggable_flag_fields.html.erb
|
269
264
|
- app/views/detour/flaggable_flags/error.js.erb
|
270
265
|
- app/views/detour/flaggable_flags/index.html.erb
|
271
266
|
- app/views/detour/flaggable_flags/success.js.erb
|
272
267
|
- app/views/detour/flags/_feature_form.html.erb
|
273
268
|
- app/views/detour/flags/index.html.erb
|
269
|
+
- app/views/detour/groups/_group.html.erb
|
270
|
+
- app/views/detour/groups/_membership_fields.html.erb
|
271
|
+
- app/views/detour/groups/index.html.erb
|
272
|
+
- app/views/detour/groups/show.html.erb
|
273
|
+
- app/views/detour/memberships/_membership.html.erb
|
274
|
+
- app/views/detour/shared/_errors.html.erb
|
274
275
|
- app/views/detour/shared/_nav.html.erb
|
275
276
|
- app/views/detour/shared/_spacer_cells.html.erb
|
277
|
+
- app/views/detour/shared/error.js.erb
|
278
|
+
- app/views/detour/shared/success.js.erb
|
276
279
|
- app/views/layouts/detour/application.html.erb
|
280
|
+
- config/locales/en.yml
|
277
281
|
- config/routes.rb
|
278
282
|
- detour.gemspec
|
279
283
|
- lib/detour.rb
|
@@ -286,12 +290,13 @@ files:
|
|
286
290
|
- lib/generators/detour_generator.rb
|
287
291
|
- lib/generators/templates/detour.rb
|
288
292
|
- lib/generators/templates/migration.rb
|
289
|
-
- lib/tasks
|
293
|
+
- lib/tasks/.gitkeep
|
290
294
|
- script/rails
|
291
295
|
- spec/controllers/detour/application_controller_spec.rb
|
292
296
|
- spec/controllers/detour/features_controller_spec.rb
|
293
297
|
- spec/controllers/detour/flaggable_flags_controller_spec.rb
|
294
298
|
- spec/controllers/detour/flags_controller_spec.rb
|
299
|
+
- spec/controllers/detour/groups_controller_spec.rb
|
295
300
|
- spec/dummy/README.rdoc
|
296
301
|
- spec/dummy/Rakefile
|
297
302
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -334,31 +339,38 @@ files:
|
|
334
339
|
- spec/dummy/public/500.html
|
335
340
|
- spec/dummy/public/favicon.ico
|
336
341
|
- spec/dummy/script/rails
|
342
|
+
- spec/factories/database_group_flag.rb
|
343
|
+
- spec/factories/defined_group_flag.rb
|
337
344
|
- spec/factories/feature.rb
|
338
345
|
- spec/factories/flag_in_flag.rb
|
339
|
-
- spec/factories/
|
346
|
+
- spec/factories/group.rb
|
347
|
+
- spec/factories/membership.rb
|
340
348
|
- spec/factories/opt_out_flag.rb
|
341
349
|
- spec/factories/percentage_flag.rb
|
342
350
|
- spec/factories/user.rb
|
343
351
|
- spec/factories/widget.rb
|
352
|
+
- spec/features/database_group_flags_spec.rb
|
353
|
+
- spec/features/database_groups_spec.rb
|
354
|
+
- spec/features/defined_group_flags_spec.rb
|
344
355
|
- spec/features/features_spec.rb
|
345
356
|
- spec/features/flag_in_flags_spec.rb
|
346
|
-
- spec/features/group_flags_spec.rb
|
347
357
|
- spec/features/home_page_spec.rb
|
348
358
|
- spec/features/opt_out_flags_spec.rb
|
349
359
|
- spec/features/percentage_flags_spec.rb
|
350
|
-
- spec/integration/flag_rollout_spec.rb
|
351
360
|
- spec/integration/group_rollout_spec.rb
|
352
361
|
- spec/integration/percentage_rollout_spec.rb
|
353
362
|
- spec/lib/detour/acts_as_flaggable_spec.rb
|
354
363
|
- spec/lib/detour/configuration_spec.rb
|
355
364
|
- spec/lib/detour/flag_form_spec.rb
|
356
365
|
- spec/lib/detour/flaggable_spec.rb
|
357
|
-
- spec/
|
366
|
+
- spec/models/detour/database_group_flag_spec.rb
|
367
|
+
- spec/models/detour/defined_group_spec.rb
|
358
368
|
- spec/models/detour/feature_spec.rb
|
359
369
|
- spec/models/detour/flag_in_flag_spec.rb
|
360
370
|
- spec/models/detour/flag_spec.rb
|
371
|
+
- spec/models/detour/flaggable_flag_spec.rb
|
361
372
|
- spec/models/detour/group_flag_spec.rb
|
373
|
+
- spec/models/detour/membership_spec.rb
|
362
374
|
- spec/models/detour/opt_out_flag_spec.rb
|
363
375
|
- spec/models/detour/percentage_flag_spec.rb
|
364
376
|
- spec/spec_helper.rb
|
@@ -366,36 +378,33 @@ files:
|
|
366
378
|
homepage: https://github.com/heroku/detour
|
367
379
|
licenses:
|
368
380
|
- MIT
|
381
|
+
metadata: {}
|
369
382
|
post_install_message:
|
370
383
|
rdoc_options: []
|
371
384
|
require_paths:
|
372
385
|
- lib
|
373
386
|
required_ruby_version: !ruby/object:Gem::Requirement
|
374
|
-
none: false
|
375
387
|
requirements:
|
376
|
-
- -
|
388
|
+
- - ">="
|
377
389
|
- !ruby/object:Gem::Version
|
378
390
|
version: 1.9.3
|
379
391
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
380
|
-
none: false
|
381
392
|
requirements:
|
382
|
-
- -
|
393
|
+
- - ">="
|
383
394
|
- !ruby/object:Gem::Version
|
384
395
|
version: '0'
|
385
|
-
segments:
|
386
|
-
- 0
|
387
|
-
hash: 1765350424629187906
|
388
396
|
requirements: []
|
389
397
|
rubyforge_project:
|
390
|
-
rubygems_version:
|
398
|
+
rubygems_version: 2.2.0
|
391
399
|
signing_key:
|
392
|
-
specification_version:
|
400
|
+
specification_version: 4
|
393
401
|
summary: Rollouts (feature flags) for Rails.
|
394
402
|
test_files:
|
395
403
|
- spec/controllers/detour/application_controller_spec.rb
|
396
404
|
- spec/controllers/detour/features_controller_spec.rb
|
397
405
|
- spec/controllers/detour/flaggable_flags_controller_spec.rb
|
398
406
|
- spec/controllers/detour/flags_controller_spec.rb
|
407
|
+
- spec/controllers/detour/groups_controller_spec.rb
|
399
408
|
- spec/dummy/README.rdoc
|
400
409
|
- spec/dummy/Rakefile
|
401
410
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -438,31 +447,38 @@ test_files:
|
|
438
447
|
- spec/dummy/public/500.html
|
439
448
|
- spec/dummy/public/favicon.ico
|
440
449
|
- spec/dummy/script/rails
|
450
|
+
- spec/factories/database_group_flag.rb
|
451
|
+
- spec/factories/defined_group_flag.rb
|
441
452
|
- spec/factories/feature.rb
|
442
453
|
- spec/factories/flag_in_flag.rb
|
443
|
-
- spec/factories/
|
454
|
+
- spec/factories/group.rb
|
455
|
+
- spec/factories/membership.rb
|
444
456
|
- spec/factories/opt_out_flag.rb
|
445
457
|
- spec/factories/percentage_flag.rb
|
446
458
|
- spec/factories/user.rb
|
447
459
|
- spec/factories/widget.rb
|
460
|
+
- spec/features/database_group_flags_spec.rb
|
461
|
+
- spec/features/database_groups_spec.rb
|
462
|
+
- spec/features/defined_group_flags_spec.rb
|
448
463
|
- spec/features/features_spec.rb
|
449
464
|
- spec/features/flag_in_flags_spec.rb
|
450
|
-
- spec/features/group_flags_spec.rb
|
451
465
|
- spec/features/home_page_spec.rb
|
452
466
|
- spec/features/opt_out_flags_spec.rb
|
453
467
|
- spec/features/percentage_flags_spec.rb
|
454
|
-
- spec/integration/flag_rollout_spec.rb
|
455
468
|
- spec/integration/group_rollout_spec.rb
|
456
469
|
- spec/integration/percentage_rollout_spec.rb
|
457
470
|
- spec/lib/detour/acts_as_flaggable_spec.rb
|
458
471
|
- spec/lib/detour/configuration_spec.rb
|
459
472
|
- spec/lib/detour/flag_form_spec.rb
|
460
473
|
- spec/lib/detour/flaggable_spec.rb
|
461
|
-
- spec/
|
474
|
+
- spec/models/detour/database_group_flag_spec.rb
|
475
|
+
- spec/models/detour/defined_group_spec.rb
|
462
476
|
- spec/models/detour/feature_spec.rb
|
463
477
|
- spec/models/detour/flag_in_flag_spec.rb
|
464
478
|
- spec/models/detour/flag_spec.rb
|
479
|
+
- spec/models/detour/flaggable_flag_spec.rb
|
465
480
|
- spec/models/detour/group_flag_spec.rb
|
481
|
+
- spec/models/detour/membership_spec.rb
|
466
482
|
- spec/models/detour/opt_out_flag_spec.rb
|
467
483
|
- spec/models/detour/percentage_flag_spec.rb
|
468
484
|
- spec/spec_helper.rb
|
@@ -1,141 +0,0 @@
|
|
1
|
-
module Detour::Concerns
|
2
|
-
module FlagActions
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
module ClassMethods
|
6
|
-
# Add a record to the given feature. If the feature is not found, an
|
7
|
-
# ActiveRecord::RecordNotFound will be raised.
|
8
|
-
#
|
9
|
-
# @example
|
10
|
-
# Detour::Feature.add_record_to_feature user, :new_ui
|
11
|
-
#
|
12
|
-
# @param [ActiveRecord::Base] record A record to add the feature to.
|
13
|
-
# @param [String,Symbol] feature_name The feature to be added to the record.
|
14
|
-
#
|
15
|
-
# @return [Detour::Flag] The
|
16
|
-
# {Detour::Flag Flag} created.
|
17
|
-
def add_record_to_feature(record, feature_name)
|
18
|
-
feature = find_by_name!(feature_name)
|
19
|
-
feature.flag_in_flags.where(flaggable_type: record.class.to_s, flaggable_id: record.id).first_or_create!
|
20
|
-
end
|
21
|
-
|
22
|
-
# Remove a record from the given feature. If the feature is not found, an
|
23
|
-
# ActiveRecord::RecordNotFound will be raised.
|
24
|
-
#
|
25
|
-
# @example
|
26
|
-
# Detour::Feature.remove_record_from_feature user, :new_ui
|
27
|
-
#
|
28
|
-
# @param [ActiveRecord::Base] record A record to remove the feature from.
|
29
|
-
# @param [String,Symbol] feature_name The feature to be removed from the
|
30
|
-
# record.
|
31
|
-
def remove_record_from_feature(record, feature_name)
|
32
|
-
feature = find_by_name!(feature_name)
|
33
|
-
feature.flag_in_flags.where(flaggable_type: record.class.to_s, flaggable_id: record.id).destroy_all
|
34
|
-
end
|
35
|
-
|
36
|
-
# Opt the given record out of a feature. If the feature is not found, an
|
37
|
-
# ActiveRecord::RecordNotFound will be raised. An opt out ensures that no
|
38
|
-
# matter what, `record.rollout?(:rollout)` will always return false for any
|
39
|
-
# opted-out-of features.
|
40
|
-
#
|
41
|
-
# @param [ActiveRecord::Base] record A record to opt out of the feature.
|
42
|
-
# @param [String,Symbol] feature_name The feature to be opted out of.
|
43
|
-
#
|
44
|
-
# @example
|
45
|
-
# Detour::Feature.opt_record_out_of_feature user, :new_ui
|
46
|
-
#
|
47
|
-
# @return [Detour::OptOut] The
|
48
|
-
# {Detour::OptOut OptOut} created.
|
49
|
-
def opt_record_out_of_feature(record, feature_name)
|
50
|
-
feature = find_by_name!(feature_name)
|
51
|
-
feature.opt_out_flags.where(flaggable_type: record.class.to_s, flaggable_id: record.id).first_or_create!
|
52
|
-
end
|
53
|
-
|
54
|
-
# Remove any opt out for the given record out of a feature. If the feature
|
55
|
-
# is not found, an ActiveRecord::RecordNotFound will be raised.
|
56
|
-
#
|
57
|
-
# @example
|
58
|
-
# Detour::Feature.un_opt_record_out_of_feature user, :new_ui
|
59
|
-
#
|
60
|
-
# @param [ActiveRecord::Base] record A record to un-opt-out of the feature.
|
61
|
-
# @param [String,Symbol] feature_name The feature to be un-opted-out of.
|
62
|
-
def un_opt_record_out_of_feature(record, feature_name)
|
63
|
-
feature = find_by_name!(feature_name)
|
64
|
-
feature.opt_out_flags.where(flaggable_type: record.class.to_s, flaggable_id: record.id).destroy_all
|
65
|
-
end
|
66
|
-
|
67
|
-
# Add a group to the given feature. If the feature is not found, an
|
68
|
-
# ActiveRecord::RecordNotFound will be raised.
|
69
|
-
#
|
70
|
-
# @example
|
71
|
-
# Detour::Feature.add_group_to_feature "User", "admin", :delete_records
|
72
|
-
#
|
73
|
-
# @param [String] flaggable_type The class (as a string) that the group
|
74
|
-
# should be associated with.
|
75
|
-
# @param [String] group_name The name of the group to have the feature
|
76
|
-
# added to it.
|
77
|
-
# @param [String,Symbol] feature_name The feature to be added to the group.
|
78
|
-
#
|
79
|
-
# @return [Detour::Flag] The
|
80
|
-
# {Detour::Flag Flag} created.
|
81
|
-
def add_group_to_feature(flaggable_type, group_name, feature_name)
|
82
|
-
feature = find_by_name!(feature_name)
|
83
|
-
feature.group_flags.where(flaggable_type: flaggable_type, group_name: group_name).first_or_create!
|
84
|
-
end
|
85
|
-
|
86
|
-
# Remove a group from agiven feature. If the feature is not found, an
|
87
|
-
# ActiveRecord::RecordNotFound will be raised.
|
88
|
-
#
|
89
|
-
# @example
|
90
|
-
# Detour::Feature.remove_group_from_feature "User", "admin", :delete_records
|
91
|
-
#
|
92
|
-
# @param [String] flaggable_type The class (as a string) that the group should
|
93
|
-
# be removed from.
|
94
|
-
# @param [String] group_name The name of the group to have the feature
|
95
|
-
# removed from it.
|
96
|
-
# @param [String,Symbol] feature_name The feature to be removed from the
|
97
|
-
# group.
|
98
|
-
def remove_group_from_feature(flaggable_type, group_name, feature_name)
|
99
|
-
feature = find_by_name!(feature_name)
|
100
|
-
feature.group_flags.where(flaggable_type: flaggable_type, group_name: group_name).destroy_all
|
101
|
-
end
|
102
|
-
|
103
|
-
# Add a percentage of records to the given feature. If the feature is not
|
104
|
-
# found, an ActiveRecord::RecordNotFound will be raised.
|
105
|
-
#
|
106
|
-
# @example
|
107
|
-
# Detour::Feature.add_percentage_to_feature "User", 75, :delete_records
|
108
|
-
#
|
109
|
-
# @param [String] flaggable_type The class (as a string) that the percetnage
|
110
|
-
# should be associated with.
|
111
|
-
# @param [Integer] percentage The percentage of `flaggable_type` records
|
112
|
-
# that the feature will be available for.
|
113
|
-
# @param [String,Symbol] feature_name The feature to be added to the
|
114
|
-
# percentage of records.
|
115
|
-
#
|
116
|
-
# @return [Detour::Flag] The
|
117
|
-
# {Detour::Flag Flag} created.
|
118
|
-
def add_percentage_to_feature(flaggable_type, percentage, feature_name)
|
119
|
-
feature = find_by_name!(feature_name)
|
120
|
-
|
121
|
-
flag = feature.percentage_flags.where(flaggable_type: flaggable_type).first_or_initialize
|
122
|
-
flag.update_attributes!(percentage: percentage)
|
123
|
-
end
|
124
|
-
|
125
|
-
# Remove any percentage flags for the given feature. If the feature is not
|
126
|
-
# found, an ActiveRecord::RecordNotFound will be raised.
|
127
|
-
#
|
128
|
-
# @example
|
129
|
-
# Detour::Feature.remove_percentage_from_feature "User", delete_records
|
130
|
-
#
|
131
|
-
# @param [String] flaggable_type The class (as a string) that the percetnage
|
132
|
-
# should be removed from.
|
133
|
-
# @param [String,Symbol] feature_name The feature to have the percentage
|
134
|
-
# flag removed from.
|
135
|
-
def remove_percentage_from_feature(flaggable_type, feature_name)
|
136
|
-
feature = find_by_name!(feature_name)
|
137
|
-
feature.percentage_flags.where(flaggable_type: flaggable_type).destroy_all
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# A group of flaggable records of a given class may be flagged into a feature
|
2
|
-
# with this class.
|
3
|
-
class Detour::GroupFlag < Detour::Flag
|
4
|
-
validates_presence_of :group_name
|
5
|
-
validates_uniqueness_of :feature_id, scope: [:flaggable_type, :group_name]
|
6
|
-
|
7
|
-
attr_writer :to_keep
|
8
|
-
attr_accessible :group_name
|
9
|
-
|
10
|
-
def to_keep
|
11
|
-
@to_keep || (!marked_for_destruction? && !new_record?)
|
12
|
-
end
|
13
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<div class="alert alert-success"><%= flash.notice %></div>
|