split 3.4.0 → 4.0.1

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/dependabot.yml +7 -0
  4. data/.github/workflows/ci.yml +71 -0
  5. data/.rubocop.yml +177 -1
  6. data/.rubocop_todo.yml +40 -493
  7. data/CHANGELOG.md +41 -0
  8. data/Gemfile +1 -0
  9. data/README.md +26 -6
  10. data/Rakefile +1 -0
  11. data/gemfiles/{4.2.gemfile → 6.1.gemfile} +1 -1
  12. data/gemfiles/7.0.gemfile +9 -0
  13. data/lib/split/algorithms/block_randomization.rb +1 -0
  14. data/lib/split/algorithms/weighted_sample.rb +2 -1
  15. data/lib/split/algorithms/whiplash.rb +3 -2
  16. data/lib/split/alternative.rb +1 -0
  17. data/lib/split/cache.rb +28 -0
  18. data/lib/split/combined_experiments_helper.rb +1 -0
  19. data/lib/split/configuration.rb +8 -12
  20. data/lib/split/dashboard/helpers.rb +1 -0
  21. data/lib/split/dashboard/pagination_helpers.rb +1 -0
  22. data/lib/split/dashboard/paginator.rb +1 -0
  23. data/lib/split/dashboard/public/dashboard.js +10 -0
  24. data/lib/split/dashboard/public/style.css +5 -0
  25. data/lib/split/dashboard/views/_controls.erb +13 -0
  26. data/lib/split/dashboard.rb +17 -2
  27. data/lib/split/encapsulated_helper.rb +3 -2
  28. data/lib/split/engine.rb +5 -4
  29. data/lib/split/exceptions.rb +1 -0
  30. data/lib/split/experiment.rb +82 -60
  31. data/lib/split/experiment_catalog.rb +1 -3
  32. data/lib/split/extensions/string.rb +1 -0
  33. data/lib/split/goals_collection.rb +1 -0
  34. data/lib/split/helper.rb +26 -7
  35. data/lib/split/metric.rb +2 -1
  36. data/lib/split/persistence/cookie_adapter.rb +6 -1
  37. data/lib/split/persistence/redis_adapter.rb +5 -0
  38. data/lib/split/persistence/session_adapter.rb +1 -0
  39. data/lib/split/persistence.rb +4 -2
  40. data/lib/split/redis_interface.rb +8 -28
  41. data/lib/split/trial.rb +20 -10
  42. data/lib/split/user.rb +15 -3
  43. data/lib/split/version.rb +2 -4
  44. data/lib/split/zscore.rb +1 -0
  45. data/lib/split.rb +9 -3
  46. data/spec/alternative_spec.rb +1 -1
  47. data/spec/cache_spec.rb +88 -0
  48. data/spec/configuration_spec.rb +17 -15
  49. data/spec/dashboard_spec.rb +45 -5
  50. data/spec/encapsulated_helper_spec.rb +1 -1
  51. data/spec/experiment_spec.rb +78 -13
  52. data/spec/goals_collection_spec.rb +1 -1
  53. data/spec/helper_spec.rb +68 -32
  54. data/spec/persistence/cookie_adapter_spec.rb +1 -1
  55. data/spec/persistence/redis_adapter_spec.rb +9 -0
  56. data/spec/redis_interface_spec.rb +0 -69
  57. data/spec/spec_helper.rb +5 -6
  58. data/spec/trial_spec.rb +45 -19
  59. data/spec/user_spec.rb +34 -3
  60. data/split.gemspec +7 -7
  61. metadata +27 -35
  62. data/.travis.yml +0 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a24a0e9549dc87669984c000cc285627233dec8824829897b39c2787925ca4d
4
- data.tar.gz: be237da0ea36471894503a9eee2a2dbfba2fe6f9a4563b6071950f449760e069
3
+ metadata.gz: c6b66f4b21c4201228d9622d5e00ff2a2e957714edfce11316316a2ca3e405ce
4
+ data.tar.gz: 6a441cf39a14ef9e36b805e7728f34029db7f7d1e1e90f3389168942b7b77f60
5
5
  SHA512:
6
- metadata.gz: 3b5218890aedc5ec4de12c4f5b03f25eb3857aadd337c188f8cb71608ba9bc8519e8f9b4040b638d1ce443220acb5535064a7815ba71bb1d802026d2c4798e13
7
- data.tar.gz: efd41eb33dd434dfd6e0c961b4c3b37b9097a0e0b7e6677ac537a62527c0b5e9938d2e7b232a6ee3e6268946ca96e6f4e38fae60ace6341d77fa82ee88affaa3
6
+ metadata.gz: bc46df4b6f301b8bdaf99ba4648f7363ad2c1234b3be7586e078b9772fec9a2bae3c9e15335c0c207e88c45113a1348a0dcd608a9dcfee654846753ba59c6696
7
+ data.tar.gz: 53dffc60d0f0617f1a1e943170f7702eff6ec5d00381b9d3b19380ef50aaef4c76956974a94a645bfb288eddd75486f24c2c2d3c56e7465f85f68791f1aeda31
@@ -0,0 +1 @@
1
+ open_collective: split
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
@@ -0,0 +1,71 @@
1
+ name: split
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ matrix:
9
+ include:
10
+ - gemfile: 5.2.gemfile
11
+ ruby: 2.5
12
+
13
+ - gemfile: 5.2.gemfile
14
+ ruby: 2.6
15
+
16
+ - gemfile: 5.2.gemfile
17
+ ruby: 2.7
18
+
19
+ - gemfile: 6.0.gemfile
20
+ ruby: 2.5
21
+
22
+ - gemfile: 6.0.gemfile
23
+ ruby: 2.6
24
+
25
+ - gemfile: 6.0.gemfile
26
+ ruby: 2.7
27
+
28
+ - gemfile: 6.0.gemfile
29
+ ruby: '3.0'
30
+
31
+ - gemfile: 6.1.gemfile
32
+ ruby: '3.0'
33
+
34
+ - gemfile: 7.0.gemfile
35
+ ruby: '3.0'
36
+
37
+ # - gemfile: 7.0.gemfile
38
+ # ruby: '3.1'
39
+
40
+
41
+ runs-on: ubuntu-latest
42
+
43
+ services:
44
+ redis:
45
+ image: redis
46
+ ports: ['6379:6379']
47
+ options: >-
48
+ --health-cmd "redis-cli ping"
49
+ --health-interval 10s
50
+ --health-timeout 5s
51
+ --health-retries 5
52
+
53
+ steps:
54
+ - uses: actions/checkout@v2
55
+
56
+ - uses: ruby/setup-ruby@v1
57
+ with:
58
+ ruby-version: ${{ matrix.ruby }}
59
+
60
+ - name: Install dependencies
61
+ run: |
62
+ bundle config set gemfile "${GITHUB_WORKSPACE}/gemfiles/${{ matrix.gemfile }}"
63
+ bundle install --jobs 4 --retry 3
64
+
65
+ - name: Display Ruby version
66
+ run: ruby -v
67
+
68
+ - name: Test
69
+ run: bundle exec rspec
70
+ env:
71
+ REDIS_URL: redis:6379
data/.rubocop.yml CHANGED
@@ -1,7 +1,183 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
+ TargetRubyVersion: 2.5
5
+ DisabledByDefault: true
4
6
  Exclude:
5
7
  - 'Appraisals'
6
8
  - 'gemfiles/**/*'
7
- - 'spec/**/*.rb'
9
+ - 'spec/**/*.rb'
10
+
11
+ Style/AndOr:
12
+ Enabled: true
13
+
14
+ Layout/CaseIndentation:
15
+ Enabled: true
16
+
17
+ Layout/ClosingHeredocIndentation:
18
+ Enabled: true
19
+
20
+ Layout/CommentIndentation:
21
+ Enabled: true
22
+
23
+ Layout/ElseAlignment:
24
+ Enabled: true
25
+
26
+ Layout/EndAlignment:
27
+ Enabled: true
28
+ EnforcedStyleAlignWith: variable
29
+ AutoCorrect: true
30
+
31
+ Layout/EmptyLineAfterMagicComment:
32
+ Enabled: true
33
+
34
+ Layout/EmptyLinesAroundAccessModifier:
35
+ Enabled: true
36
+ EnforcedStyle: only_before
37
+
38
+ Layout/EmptyLinesAroundBlockBody:
39
+ Enabled: true
40
+
41
+ Layout/EmptyLinesAroundClassBody:
42
+ Enabled: true
43
+
44
+ Layout/EmptyLinesAroundMethodBody:
45
+ Enabled: true
46
+
47
+ Layout/EmptyLinesAroundModuleBody:
48
+ Enabled: true
49
+
50
+ Style/HashSyntax:
51
+ Enabled: true
52
+
53
+ Layout/FirstArgumentIndentation:
54
+ Enabled: true
55
+
56
+ Layout/IndentationConsistency:
57
+ Enabled: true
58
+ EnforcedStyle: indented_internal_methods
59
+
60
+ Layout/IndentationWidth:
61
+ Enabled: true
62
+
63
+ Layout/LeadingCommentSpace:
64
+ Enabled: true
65
+
66
+ Layout/SpaceAfterColon:
67
+ Enabled: true
68
+
69
+ Layout/SpaceAfterComma:
70
+ Enabled: true
71
+
72
+ Layout/SpaceAfterSemicolon:
73
+ Enabled: true
74
+
75
+ Layout/SpaceAroundEqualsInParameterDefault:
76
+ Enabled: true
77
+
78
+ Layout/SpaceAroundKeyword:
79
+ Enabled: true
80
+
81
+ Layout/SpaceBeforeComma:
82
+ Enabled: true
83
+
84
+ Layout/SpaceBeforeComment:
85
+ Enabled: true
86
+
87
+ Layout/SpaceBeforeFirstArg:
88
+ Enabled: true
89
+
90
+ Style/DefWithParentheses:
91
+ Enabled: true
92
+
93
+ Style/MethodDefParentheses:
94
+ Enabled: true
95
+
96
+ Style/FrozenStringLiteralComment:
97
+ Enabled: true
98
+ EnforcedStyle: always
99
+
100
+ Style/RedundantFreeze:
101
+ Enabled: true
102
+
103
+ Layout/SpaceBeforeBlockBraces:
104
+ Enabled: true
105
+
106
+ Layout/SpaceInsideBlockBraces:
107
+ Enabled: true
108
+ EnforcedStyleForEmptyBraces: space
109
+
110
+ Layout/SpaceInsideHashLiteralBraces:
111
+ Enabled: true
112
+
113
+ Layout/SpaceInsideParens:
114
+ Enabled: true
115
+
116
+ Style/StringLiterals:
117
+ Enabled: false
118
+ EnforcedStyle: double_quotes
119
+
120
+ Layout/IndentationStyle:
121
+ Enabled: true
122
+
123
+ Layout/TrailingEmptyLines:
124
+ Enabled: true
125
+
126
+ Layout/TrailingWhitespace:
127
+ Enabled: true
128
+
129
+ Style/RedundantPercentQ:
130
+ Enabled: true
131
+
132
+ Lint/AmbiguousOperator:
133
+ Enabled: true
134
+
135
+ Lint/AmbiguousRegexpLiteral:
136
+ Enabled: true
137
+
138
+ Lint/ErbNewArguments:
139
+ Enabled: true
140
+
141
+ Lint/RequireParentheses:
142
+ Enabled: true
143
+
144
+ Lint/ShadowingOuterLocalVariable:
145
+ Enabled: true
146
+
147
+ Lint/RedundantStringCoercion:
148
+ Enabled: true
149
+
150
+ Lint/UriEscapeUnescape:
151
+ Enabled: true
152
+
153
+ Lint/UselessAssignment:
154
+ Enabled: true
155
+
156
+ Lint/DeprecatedClassMethods:
157
+ Enabled: true
158
+
159
+ Style/ParenthesesAroundCondition:
160
+ Enabled: true
161
+
162
+ Style/HashTransformKeys:
163
+ Enabled: true
164
+
165
+ Style/HashTransformValues:
166
+ Enabled: true
167
+
168
+ Style/RedundantBegin:
169
+ Enabled: true
170
+
171
+ Style/RedundantReturn:
172
+ Enabled: true
173
+ AllowMultipleReturnValues: true
174
+
175
+ Style/Semicolon:
176
+ Enabled: true
177
+ AllowAsExpressionSeparator: true
178
+
179
+ Style/ColonMethodCall:
180
+ Enabled: true
181
+
182
+ Style/TrivialAccessors:
183
+ Enabled: true