vanity 2.2.10 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +55 -0
  3. data/Appraisals +24 -20
  4. data/CHANGELOG +19 -1
  5. data/Gemfile +2 -1
  6. data/Gemfile.lock +23 -15
  7. data/README.md +14 -16
  8. data/gemfiles/rails42.gemfile +6 -6
  9. data/gemfiles/rails42.gemfile.lock +95 -86
  10. data/gemfiles/rails42_protected_attributes.gemfile +6 -6
  11. data/gemfiles/rails42_protected_attributes.gemfile.lock +90 -81
  12. data/gemfiles/{rails5.gemfile → rails51.gemfile} +6 -6
  13. data/gemfiles/rails51.gemfile.lock +285 -0
  14. data/gemfiles/{rails41.gemfile → rails52.gemfile} +6 -6
  15. data/gemfiles/rails52.gemfile.lock +295 -0
  16. data/gemfiles/{rails32.gemfile → rails60.gemfile} +6 -9
  17. data/gemfiles/rails60.gemfile.lock +293 -0
  18. data/gemfiles/rails61.gemfile +33 -0
  19. data/gemfiles/rails61.gemfile.lock +293 -0
  20. data/lib/generators/templates/{add_participants_unique_index_migration.rb → add_participants_unique_index_migration.rb.erb} +1 -1
  21. data/lib/generators/templates/{add_unique_indexes_migration.rb → add_unique_indexes_migration.rb.erb} +1 -1
  22. data/lib/generators/templates/{vanity_migration.rb → vanity_migration.rb.erb} +1 -1
  23. data/lib/generators/vanity/migration_generator.rb +34 -0
  24. data/lib/vanity/adapters/active_record_adapter.rb +1 -1
  25. data/lib/vanity/adapters/redis_adapter.rb +20 -20
  26. data/lib/vanity/commands/report.rb +4 -3
  27. data/lib/vanity/configuration.rb +4 -0
  28. data/lib/vanity/experiment/ab_test.rb +16 -11
  29. data/lib/vanity/frameworks/rails.rb +20 -9
  30. data/lib/vanity/locales/vanity.ru.yml +50 -0
  31. data/lib/vanity/templates/_experiment.erb +3 -3
  32. data/lib/vanity/templates/_experiments.erb +1 -1
  33. data/lib/vanity/templates/_metrics.erb +1 -1
  34. data/lib/vanity/templates/_report.erb +2 -2
  35. data/lib/vanity/version.rb +1 -1
  36. data/test/adapters/redis_adapter_test.rb +8 -12
  37. data/test/adapters/shared_tests.rb +7 -6
  38. data/test/commands/report_test.rb +13 -1
  39. data/test/configuration_test.rb +15 -2
  40. data/test/dummy/app/mailers/vanity_mailer.rb +3 -1
  41. data/test/dummy/config/initializers/secret_token.rb +5 -2
  42. data/test/dummy/config/routes.rb +17 -3
  43. data/test/experiment/ab_test.rb +43 -3
  44. data/test/frameworks/rails/action_controller_test.rb +12 -6
  45. data/test/frameworks/rails/action_mailer_test.rb +0 -1
  46. data/test/metric/active_record_test.rb +8 -2
  47. data/test/playground_test.rb +0 -1
  48. data/test/test_helper.rb +57 -10
  49. data/test/web/rails/dashboard_test.rb +19 -10
  50. data/vanity.gemspec +1 -1
  51. metadata +20 -21
  52. data/.travis.yml +0 -33
  53. data/gemfiles/rails32.gemfile.lock +0 -242
  54. data/gemfiles/rails41.gemfile.lock +0 -230
  55. data/gemfiles/rails5.gemfile.lock +0 -256
  56. data/lib/generators/vanity/add_participants_unique_index_generator.rb +0 -15
  57. data/lib/generators/vanity/add_unique_indexes_generator.rb +0 -15
  58. data/lib/generators/vanity_generator.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b58da5ddd59dcdd27e4742ad396ae92e3dd80f45
4
- data.tar.gz: 0aa99c5fa92179b2f3c0f43b1e91ddf187650ccf
2
+ SHA256:
3
+ metadata.gz: c54611b7ef436ec37192b30fa8451ab592b7117df14f3d3937747484b8b9a299
4
+ data.tar.gz: 7601b961767d868205a68bf02f5a44447c01f01083f5d53d4a8d7ab242c0f0fc
5
5
  SHA512:
6
- metadata.gz: 43fb068dc90d3dc6a8e57db177635e1aace3c3928c4f0085dfce9965120d282df05d895c0bcfc2d6d742329792cf2552d0b475316a0307657873d006fcd8b776
7
- data.tar.gz: aff2012cc568b8b689b9b0f6570fa5c4c1be7ad39fd2264cd35d0faa70e040aedb66d52d93b3641102a8f4b6ee535a0ca3060b2e3820ff6585b4df90f8ea8868
6
+ metadata.gz: 60f112ca86a32c938d762699cfc40e24ccb662294ac4059ff12035af6785a3ed294f56ffb2c99c1519bb254fab438062f39cd7b62b87f6df452180066c3d515a
7
+ data.tar.gz: 382f2fc0afcc52d375594d2586bb41a46f7bc6f3812d242de725cf9828bbb4c82938daf1e8a29e61ddcdfa82844433f8d5d9dec05d5c960d4a01c4eccf8de203
@@ -0,0 +1,55 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ branches: '*'
8
+
9
+ jobs:
10
+ test:
11
+ name: Test
12
+ runs-on: ubuntu-latest
13
+ timeout-minutes: 15
14
+ services:
15
+ redis:
16
+ image: redis
17
+ ports:
18
+ - 6379:6379
19
+ mongo:
20
+ image: mongo
21
+ ports:
22
+ - 27017:27017
23
+ strategy:
24
+ matrix:
25
+ ruby:
26
+ - 2.5
27
+ # - jruby-9.2.20.1
28
+ db:
29
+ - mongodb
30
+ - redis
31
+ - active_record
32
+ gemfile:
33
+ - gemfiles/rails42.gemfile
34
+ - gemfiles/rails42_protected_attributes.gemfile
35
+ - gemfiles/rails51.gemfile
36
+ - gemfiles/rails52.gemfile
37
+ - gemfiles/rails60.gemfile
38
+ - gemfiles/rails61.gemfile
39
+ exclude:
40
+ - ruby: jruby-9.1.13.0
41
+ gemfile: gemfiles/rails5.gemfile
42
+ env:
43
+ DB: ${{ matrix.db }}
44
+ BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
45
+ steps:
46
+ - name: Checkout code
47
+ uses: actions/checkout@v2
48
+
49
+ - name: Set up Ruby
50
+ uses: ruby/setup-ruby@v1
51
+ with:
52
+ ruby-version: ${{ matrix.ruby }}
53
+ bundler-cache: true
54
+ - name: Run Tests
55
+ run: bundle exec rake test
data/Appraisals CHANGED
@@ -1,38 +1,42 @@
1
- appraise "rails32" do
1
+ appraise "rails42" do
2
2
  gem "mocha", "~> 1.0", :require=>false
3
- gem "minitest", "~>4.2.0"
4
- gem "rails", "3.2.22"
5
- gem "minitest_tu_shim", "~> 1.3.3", :platforms => :mri_22
6
- gem "fastthread", :git => "git://github.com/zoltankiss/fastthread.git", :platforms => :mri_20
3
+ gem "rails", "4.2.9"
4
+ gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
7
5
  gem "passenger", "~>3.0"
8
- gem "test-unit", "~> 3.0"
9
6
  end
10
7
 
11
- appraise "rails41" do
8
+ appraise "rails42-protected_attributes" do
9
+ gem "protected_attributes", "1.1.0"
12
10
  gem "mocha", "~> 1.0", :require=>false
13
- gem "rails", "4.1.9"
14
- gem "fastthread", :git => "git://github.com/zoltankiss/fastthread.git", :platforms => :mri_20
11
+ gem "rails", "4.2.9"
12
+ gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
15
13
  gem "passenger", "~>3.0"
16
14
  end
17
15
 
18
- appraise "rails42" do
16
+ appraise "rails51" do
19
17
  gem "mocha", "~> 1.0", :require=>false
20
- gem "rails", "4.2.0"
21
- gem "fastthread", :git => "git://github.com/zoltankiss/fastthread.git", :platforms => :mri_20
18
+ gem "rails", "~>5.1.0"
19
+ gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
22
20
  gem "passenger", "~>3.0"
23
21
  end
24
22
 
25
- appraise "rails42-protected_attributes" do
26
- gem "protected_attributes", "1.1.0"
23
+ appraise "rails52" do
27
24
  gem "mocha", "~> 1.0", :require=>false
28
- gem "rails", "4.2.0"
29
- gem "fastthread", :git => "git://github.com/zoltankiss/fastthread.git", :platforms => :mri_20
25
+ gem "rails", "~>5.2.0"
26
+ gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
30
27
  gem "passenger", "~>3.0"
31
28
  end
32
29
 
33
- appraise "rails5" do
30
+ appraise "rails60" do
34
31
  gem "mocha", "~> 1.0", :require=>false
35
- gem "rails", "5.0.0"
36
- gem "fastthread", :git => "git://github.com/zoltankiss/fastthread.git", :platforms => :mri_20
32
+ gem "rails", "~>5.2.0"
33
+ gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
37
34
  gem "passenger", "~>3.0"
38
- end
35
+ end
36
+
37
+ appraise "rails61" do
38
+ gem "mocha", "~> 1.0", :require=>false
39
+ gem "rails", "~>5.2.0"
40
+ gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
41
+ gem "passenger", "~>3.0"
42
+ end
data/CHANGELOG CHANGED
@@ -1,4 +1,22 @@
1
- == Unreleased
1
+ == 3.1.0 (2022-01-29)
2
+
3
+ * Invoke on_assignment callback after assignment is stored in database; add global on_assignment callback (@frostmark)
4
+
5
+ == 3.0.2 (2022-01-27)
6
+
7
+ * Fix AbTest#alternative_for to always prefer persisted participants (@tgrathwell)
8
+
9
+ == 3.0.1 (2022-01-26)
10
+
11
+ * Update template rendering and update_attributes for Rails 6.1 compatibility (@bensheldon)
12
+
13
+ == 3.0.0 (2018-11-02)
14
+
15
+ * Fully destroy experiments using the Redis adapter (@urbanautomaton)
16
+ * Fix support for rails 5.1, 5.2 migrations (@phillbaker)
17
+ * Support for redis 4 (#334) (@askehansen)
18
+ * Drop support for redis-rb <= 3.2.0 (@phillbaker)
19
+ * Drop support for rails 2, test recent rubies (@phillbaker)
2
20
 
3
21
  == 2.2.10 (2018-03-18)
4
22
 
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
2
3
 
3
4
  # "development" gems in gemspec are required for testing, gems in the
4
5
  # development group here are for documentation
@@ -8,7 +9,7 @@ gemspec development_group: :test
8
9
  gem "rack"
9
10
 
10
11
  # Persistence
11
- gem "redis", ">= 2.1"
12
+ gem "redis", ">= 3.2.1"
12
13
  gem "redis-namespace", ">= 1.1.0"
13
14
  gem "mongo", "~> 2.1"
14
15
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vanity (2.2.10)
4
+ vanity (3.1.0)
5
5
  i18n
6
6
 
7
7
  GEM
@@ -15,7 +15,7 @@ GEM
15
15
  activerecord (>= 2.2)
16
16
  activesupport (2.3.14)
17
17
  addressable (2.2.7)
18
- appraisal (1.0.3)
18
+ appraisal (2.4.1)
19
19
  bundler
20
20
  rake
21
21
  thor (>= 0.14.0)
@@ -32,17 +32,18 @@ GEM
32
32
  execjs
33
33
  coffee-script-source (1.9.1)
34
34
  colorator (0.1)
35
- concurrent-ruby (1.0.5)
35
+ concurrent-ruby (1.1.9)
36
36
  crack (0.3.1)
37
37
  execjs (2.5.2)
38
38
  fakefs (0.6.7)
39
39
  fast-stemmer (1.0.2)
40
- ffi (1.9.8)
40
+ ffi (1.15.5)
41
+ ffi (1.15.5-java)
41
42
  garb (0.9.1)
42
43
  activesupport (>= 2.2.0)
43
44
  crack (>= 0.1.6)
44
45
  hitimes (1.2.2)
45
- i18n (0.9.3)
46
+ i18n (1.9.1)
46
47
  concurrent-ruby (~> 1.0)
47
48
  integration (0.1.0)
48
49
  jdbc-sqlite3 (3.8.7)
@@ -87,24 +88,31 @@ GEM
87
88
  coderay (~> 1.1.0)
88
89
  method_source (~> 0.8.1)
89
90
  slop (~> 3.4)
91
+ pry (0.10.3-java)
92
+ coderay (~> 1.1.0)
93
+ method_source (~> 0.8.1)
94
+ slop (~> 3.4)
95
+ spoon (~> 0.0)
90
96
  pygments.rb (0.6.3)
91
97
  posix-spawn (~> 0.3.6)
92
98
  yajl-ruby (~> 1.2.0)
93
99
  rack (1.1.3)
94
- rake (10.1.0)
100
+ rake (13.0.6)
95
101
  rb-fsevent (0.9.4)
96
102
  rb-inotify (0.9.5)
97
103
  ffi (>= 0.5.0)
98
104
  redcarpet (3.2.3)
99
- redis (3.0.6)
100
- redis-namespace (1.3.2)
101
- redis (~> 3.0.4)
105
+ redis (4.0.3)
106
+ redis-namespace (1.6.0)
107
+ redis (>= 3.0.4)
102
108
  rubystats (0.2.5)
103
109
  safe_yaml (1.0.4)
104
110
  sass (3.4.13)
105
111
  slop (3.6.0)
112
+ spoon (0.0.6)
113
+ ffi
106
114
  sqlite3 (1.3.10)
107
- thor (0.19.1)
115
+ thor (1.2.1)
108
116
  timecop (0.3.5)
109
117
  timers (4.0.1)
110
118
  hitimes
@@ -113,8 +121,8 @@ GEM
113
121
  webmock (1.8.0)
114
122
  addressable (>= 2.2.7)
115
123
  crack (>= 0.1.7)
116
- yajl-ruby (1.2.1)
117
- yard (0.7.5)
124
+ yajl-ruby (1.2.3)
125
+ yard (0.9.16)
118
126
 
119
127
  PLATFORMS
120
128
  java
@@ -123,7 +131,7 @@ PLATFORMS
123
131
  DEPENDENCIES
124
132
  RedCloth
125
133
  activerecord-jdbc-adapter
126
- appraisal (~> 1.0.2)
134
+ appraisal (~> 2.0)
127
135
  bundler (>= 1.8.0)
128
136
  fakefs
129
137
  garb (< 0.9.2)
@@ -135,7 +143,7 @@ DEPENDENCIES
135
143
  pry
136
144
  rack
137
145
  rake
138
- redis (>= 2.1)
146
+ redis (>= 3.2.1)
139
147
  redis-namespace (>= 1.1.0)
140
148
  rubystats (>= 0.2.5)
141
149
  sqlite3 (~> 1.3.10)
@@ -145,4 +153,4 @@ DEPENDENCIES
145
153
  yard
146
154
 
147
155
  BUNDLED WITH
148
- 1.13.0
156
+ 1.17.1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vanity
2
- [![Build
3
- Status](https://travis-ci.org/assaf/vanity.png?branch=master)](https://travis-ci.org/assaf/vanity)
2
+ [![Test Status](https://github.com/assaf/vanity/workflows/Test/badge.svg)](https://github.com/assaf/vanity/actions)
3
+
4
4
 
5
5
  Vanity is an A/B testing framework for Rails that is datastore agnostic.
6
6
 
@@ -61,7 +61,7 @@ Datastores should be configured using a `config/vanity.yml`.
61
61
  Add to your Gemfile:
62
62
 
63
63
  ```ruby
64
- gem "redis", ">= 2.1"
64
+ gem "redis", ">= 3.2"
65
65
  gem "redis-namespace", ">= 1.1.0"
66
66
  ```
67
67
 
@@ -139,10 +139,11 @@ test:
139
139
  active_record_adapter: default
140
140
  collecting: false
141
141
  production:
142
+ adapter: active_record
142
143
  active_record_adapter: postgresql
143
144
  <% uri = URI.parse(ENV['DATABASE_URL']) %>
144
145
  host: <%= uri.host %>
145
- username: <%= uri.username %>
146
+ username: <%= uri.user%>
146
147
  password: <%= uri.password %>
147
148
  port: <%= uri.port %>
148
149
  database: <%= uri.path.sub('/', '') %>
@@ -379,18 +380,15 @@ your view no participants will be recorded.
379
380
 
380
381
  Here's what's tested and known to work:
381
382
 
382
- Ruby 2.1
383
- Persistence: Redis, Mongo, ActiveRecord
384
- Rails: 3.2, 4.1, 4.2
385
- Ruby 2.2
386
- Persistence: Redis, Mongo, ActiveRecord
387
- Rails: 3.2, 4.1, 4.2, 5
388
383
  Ruby 2.3
389
- Persistence: Redis, Mongo, ActiveRecord
390
- Rails: 3.2, 4.1, 4.2, 5
391
- JRuby 1.9
392
- Persistence: Redis, Mongo, ActiveRecord
393
- Rails: 3.2, 4.1, 4.2
384
+ Persistence: Redis (redis-rb >= 3.2.1), Mongo, ActiveRecord
385
+ Rails: 4.1, 4.2, 5
386
+ Ruby 2.4
387
+ Persistence: Redis (redis-rb >= 3.2.1), Mongo, ActiveRecord
388
+ Rails: 4.1, 4.2, 5
389
+ JRuby 9.1
390
+ Persistence: Redis (redis-rb >= 3.2.1), Mongo, ActiveRecord
391
+ Rails: 4.1, 4.2
394
392
 
395
393
  ## Testing
396
394
 
@@ -427,7 +425,7 @@ Go ahead and target a pull request against the `gh-pages` branch.
427
425
  prepare the test suite to run against multiple versions of Rails
428
426
  * Fix, patch, enhance, document, improve, sprinkle pixie dust
429
427
  * Tests. Please. Run `appraisal rake test`, of if you can, `rake test:all`.
430
- (This project uses Travis CI where the test suite is run against multiple
428
+ (This project uses Github Actions where the test suite is run against multiple
431
429
  versions of ruby, rails and backends.)
432
430
  * Send a pull request on GitHub
433
431
 
@@ -3,15 +3,15 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rack"
6
- gem "redis", ">= 2.1"
6
+ gem "redis", ">= 3.2.1"
7
7
  gem "redis-namespace", ">= 1.1.0"
8
8
  gem "mongo", "~> 2.1"
9
9
  gem "integration", "<= 0.1.0"
10
10
  gem "rubystats", ">= 0.2.5"
11
- gem "garb", "< 0.9.2", :require => false
12
- gem "mocha", "~> 1.0", :require => false
13
- gem "rails", "4.2.0"
14
- gem "fastthread", :git => "git://github.com/zoltankiss/fastthread.git", :platforms => :mri_20
11
+ gem "garb", "< 0.9.2", require: false
12
+ gem "mocha", "~> 1.0", require: false
13
+ gem "rails", "4.2.9"
14
+ gem "fastthread", platforms: :mri_20, git: "https://github.com/zoltankiss/fastthread.git"
15
15
  gem "passenger", "~>3.0"
16
16
 
17
17
  group :development do
@@ -30,4 +30,4 @@ platforms :jruby do
30
30
  gem "jdbc-sqlite3"
31
31
  end
32
32
 
33
- gemspec :development_group => :test, :path => "../"
33
+ gemspec development_group: :test, path: "../"