vanity 3.0.2 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linting.yml +28 -0
- data/.github/workflows/test.yml +3 -6
- data/.rubocop.yml +114 -0
- data/.rubocop_todo.yml +67 -0
- data/Appraisals +9 -31
- data/CHANGELOG +13 -0
- data/Gemfile +7 -3
- data/Gemfile.lock +32 -4
- data/README.md +4 -9
- data/Rakefile +25 -24
- data/bin/vanity +1 -1
- data/doc/configuring.textile +1 -0
- data/gemfiles/rails52.gemfile +6 -3
- data/gemfiles/rails52.gemfile.lock +34 -9
- data/gemfiles/rails60.gemfile +6 -3
- data/gemfiles/rails60.gemfile.lock +34 -9
- data/gemfiles/rails61.gemfile +6 -3
- data/gemfiles/rails61.gemfile.lock +34 -9
- data/lib/generators/vanity/migration_generator.rb +5 -7
- data/lib/vanity/adapters/abstract_adapter.rb +43 -45
- data/lib/vanity/adapters/active_record_adapter.rb +30 -30
- data/lib/vanity/adapters/mock_adapter.rb +14 -18
- data/lib/vanity/adapters/mongodb_adapter.rb +73 -69
- data/lib/vanity/adapters/redis_adapter.rb +19 -27
- data/lib/vanity/adapters.rb +1 -1
- data/lib/vanity/autoconnect.rb +6 -7
- data/lib/vanity/commands/list.rb +7 -7
- data/lib/vanity/commands/report.rb +18 -22
- data/lib/vanity/configuration.rb +23 -19
- data/lib/vanity/connection.rb +12 -14
- data/lib/vanity/experiment/ab_test.rb +95 -79
- data/lib/vanity/experiment/alternative.rb +3 -5
- data/lib/vanity/experiment/base.rb +24 -19
- data/lib/vanity/experiment/bayesian_bandit_score.rb +7 -13
- data/lib/vanity/experiment/definition.rb +6 -6
- data/lib/vanity/frameworks/rails.rb +39 -39
- data/lib/vanity/frameworks.rb +2 -2
- data/lib/vanity/helpers.rb +1 -1
- data/lib/vanity/metric/active_record.rb +21 -19
- data/lib/vanity/metric/base.rb +22 -23
- data/lib/vanity/metric/google_analytics.rb +6 -9
- data/lib/vanity/metric/remote.rb +3 -5
- data/lib/vanity/playground.rb +3 -6
- data/lib/vanity/vanity.rb +8 -12
- data/lib/vanity/version.rb +1 -1
- data/test/adapters/active_record_adapter_test.rb +1 -5
- data/test/adapters/mock_adapter_test.rb +0 -2
- data/test/adapters/mongodb_adapter_test.rb +1 -5
- data/test/adapters/redis_adapter_test.rb +2 -3
- data/test/adapters/shared_tests.rb +9 -12
- data/test/autoconnect_test.rb +3 -3
- data/test/cli_test.rb +0 -1
- data/test/configuration_test.rb +18 -34
- data/test/connection_test.rb +3 -3
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/controllers/use_vanity_controller.rb +12 -8
- data/test/dummy/app/mailers/vanity_mailer.rb +3 -3
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/config/boot.rb +3 -3
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +0 -1
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/initializers/vanity.rb +3 -0
- data/test/dummy/config/vanity.yml +7 -0
- data/test/dummy/config.ru +1 -1
- data/test/dummy/script/rails +2 -2
- data/test/experiment/ab_test.rb +188 -154
- data/test/experiment/base_test.rb +48 -32
- data/test/frameworks/rails/action_controller_test.rb +25 -25
- data/test/frameworks/rails/action_mailer_test.rb +2 -2
- data/test/frameworks/rails/action_view_test.rb +5 -6
- data/test/frameworks/rails/rails_test.rb +147 -181
- data/test/helper_test.rb +2 -2
- data/test/metric/active_record_test.rb +174 -212
- data/test/metric/base_test.rb +21 -46
- data/test/metric/google_analytics_test.rb +17 -25
- data/test/metric/remote_test.rb +7 -10
- data/test/playground_test.rb +7 -15
- data/test/templates_test.rb +16 -20
- data/test/test_helper.rb +28 -29
- data/test/vanity_test.rb +4 -10
- data/test/web/rails/dashboard_test.rb +21 -21
- data/vanity.gemspec +8 -7
- metadata +32 -30
- data/gemfiles/rails42.gemfile +0 -33
- data/gemfiles/rails42.gemfile.lock +0 -265
- data/gemfiles/rails42_protected_attributes.gemfile +0 -34
- data/gemfiles/rails42_protected_attributes.gemfile.lock +0 -264
- data/gemfiles/rails51.gemfile +0 -33
- data/gemfiles/rails51.gemfile.lock +0 -285
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc07c2cfd7af5205d43f6ef16a4fe4607772b99613933ef37e53bbd16062ba3
|
4
|
+
data.tar.gz: c2e194bc26d672eb44c692cbdd9955476844898f53c0a39cd11ff04acbcc7c46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51422c6d58f2b8aa110c79737d4aead1edc2da7ed13def526880b37c730837831ae6104b695c25656cd6e9077c906ae45d06626d354e62197e3d50555f5dcec0
|
7
|
+
data.tar.gz: 12201f41ce6edc971928cb146cbb53c2ae09b9a61f6053ae888fa01ef180e05166836eb3f165f26adcba34f3dac523b4970593ecf7926a43d6604255afc0d8fa
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Linting
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- name: Set up Ruby 2.5
|
12
|
+
uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: 2.5
|
15
|
+
- name: Cache gems
|
16
|
+
uses: actions/cache@v1
|
17
|
+
with:
|
18
|
+
path: vendor/bundle
|
19
|
+
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
|
20
|
+
restore-keys: |
|
21
|
+
${{ runner.os }}-rubocop-
|
22
|
+
- name: Install gems
|
23
|
+
run: |
|
24
|
+
bundle config path vendor/bundle
|
25
|
+
bundle config set without 'default doc job cable storage ujs test db'
|
26
|
+
bundle install --jobs 4 --retry 3
|
27
|
+
- name: Run RuboCop
|
28
|
+
run: bundle exec rubocop --parallel
|
data/.github/workflows/test.yml
CHANGED
@@ -30,15 +30,10 @@ jobs:
|
|
30
30
|
- redis
|
31
31
|
- active_record
|
32
32
|
gemfile:
|
33
|
-
- gemfiles/rails42.gemfile
|
34
|
-
- gemfiles/rails42_protected_attributes.gemfile
|
35
|
-
- gemfiles/rails51.gemfile
|
36
33
|
- gemfiles/rails52.gemfile
|
37
34
|
- gemfiles/rails60.gemfile
|
38
35
|
- gemfiles/rails61.gemfile
|
39
|
-
|
40
|
-
- ruby: jruby-9.1.13.0
|
41
|
-
gemfile: gemfiles/rails5.gemfile
|
36
|
+
|
42
37
|
env:
|
43
38
|
DB: ${{ matrix.db }}
|
44
39
|
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
|
@@ -51,5 +46,7 @@ jobs:
|
|
51
46
|
with:
|
52
47
|
ruby-version: ${{ matrix.ruby }}
|
53
48
|
bundler-cache: true
|
49
|
+
- name: Info
|
50
|
+
run: bundle env
|
54
51
|
- name: Run Tests
|
55
52
|
run: bundle exec rake test
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require:
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rspec
|
6
|
+
|
7
|
+
inherit_mode:
|
8
|
+
merge:
|
9
|
+
- Exclude
|
10
|
+
- Include
|
11
|
+
|
12
|
+
AllCops:
|
13
|
+
TargetRubyVersion: 2.5
|
14
|
+
DisplayCopNames: true
|
15
|
+
DisplayStyleGuide: true
|
16
|
+
SuggestExtensions: false
|
17
|
+
Include:
|
18
|
+
- Rakefile
|
19
|
+
Exclude:
|
20
|
+
- pkg/**/*
|
21
|
+
- spec/test_app/**/*
|
22
|
+
- vendor/**/*
|
23
|
+
- scripts/**/*
|
24
|
+
- gemfiles/**/*
|
25
|
+
NewCops: enable
|
26
|
+
|
27
|
+
Layout/EmptyLineAfterMagicComment:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Layout/HashAlignment:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Layout/LineLength:
|
34
|
+
Max: 500
|
35
|
+
|
36
|
+
Layout/ParameterAlignment:
|
37
|
+
EnforcedStyle: with_fixed_indentation
|
38
|
+
|
39
|
+
Lint/AmbiguousBlockAssociation:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Naming/MemoizedInstanceVariableName:
|
46
|
+
EnforcedStyleForLeadingUnderscores: required
|
47
|
+
|
48
|
+
RSpec/AnyInstance:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
RSpec/DescribeClass:
|
52
|
+
Exclude:
|
53
|
+
- spec/integration/*
|
54
|
+
|
55
|
+
RSpec/ExampleLength:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
RSpec/LetSetup:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
RSpec/MessageChain:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
RSpec/MultipleExpectations:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
RSpec/MultipleDescribes:
|
68
|
+
Exclude:
|
69
|
+
- spec/lib/tasks/*
|
70
|
+
|
71
|
+
RSpec/NestedGroups:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
RSpec/MultipleMemoizedHelpers:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
Style/Documentation:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
Style/EmptyMethod:
|
81
|
+
EnforcedStyle: expanded
|
82
|
+
|
83
|
+
Style/FormatStringToken:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
Style/MultilineBlockChain:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
Style/NumericLiterals:
|
90
|
+
Enabled: false
|
91
|
+
|
92
|
+
Style/PercentLiteralDelimiters:
|
93
|
+
Enabled: false
|
94
|
+
|
95
|
+
Style/QuotedSymbols:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Style/RegexpLiteral:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
Style/StringLiterals:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Style/SymbolArray:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Style/TrailingCommaInArrayLiteral:
|
108
|
+
EnforcedStyleForMultiline: comma
|
109
|
+
|
110
|
+
Style/TrailingCommaInHashLiteral:
|
111
|
+
EnforcedStyleForMultiline: comma
|
112
|
+
|
113
|
+
Naming/VariableNumber:
|
114
|
+
EnforcedStyle: snake_case
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
Style/SpecialGlobalVars:
|
2
|
+
Enabled: false
|
3
|
+
# Style/FrozenStringLiteralComment:
|
4
|
+
# Exclude:
|
5
|
+
# - gemfiles/*.gemfile
|
6
|
+
Style/FrozenStringLiteralComment:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Style/MutableConstant:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Style/ClassAndModuleChildren:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Performance/Sum:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Performance/StringInclude:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/StringConcatenation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Naming/MemoizedInstanceVariableName:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/GlobalStdStream:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/IdenticalConditionalBranches:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Performance/InefficientHashSearch:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/NumericPredicate:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/SafeNavigation:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Style/SymbolProc:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Lint/UselessMethodDefinition:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/PreferredHashMethods:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Performance/Count:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Lint/UselessTimes:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/HashTransformKeys:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/CommentedKeyword:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Performance/RedundantEqualityComparisonBlock:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/OptionalBooleanParameter:
|
67
|
+
Enabled: false
|
data/Appraisals
CHANGED
@@ -1,42 +1,20 @@
|
|
1
|
-
appraise "rails42" do
|
2
|
-
gem "mocha", "~> 1.0", :require=>false
|
3
|
-
gem "rails", "4.2.9"
|
4
|
-
gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
|
5
|
-
gem "passenger", "~>3.0"
|
6
|
-
end
|
7
|
-
|
8
|
-
appraise "rails42-protected_attributes" do
|
9
|
-
gem "protected_attributes", "1.1.0"
|
10
|
-
gem "mocha", "~> 1.0", :require=>false
|
11
|
-
gem "rails", "4.2.9"
|
12
|
-
gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
|
13
|
-
gem "passenger", "~>3.0"
|
14
|
-
end
|
15
|
-
|
16
|
-
appraise "rails51" do
|
17
|
-
gem "mocha", "~> 1.0", :require=>false
|
18
|
-
gem "rails", "~>5.1.0"
|
19
|
-
gem "fastthread", :github => "zoltankiss/fastthread", :platforms => :mri_20
|
20
|
-
gem "passenger", "~>3.0"
|
21
|
-
end
|
22
|
-
|
23
1
|
appraise "rails52" do
|
24
|
-
gem "mocha",
|
2
|
+
gem "mocha", "~> 1.0", require: false
|
25
3
|
gem "rails", "~>5.2.0"
|
26
|
-
gem "fastthread", :
|
27
|
-
gem "passenger"
|
4
|
+
gem "fastthread", github: "zoltankiss/fastthread", platforms: :mri_20
|
5
|
+
gem "passenger"
|
28
6
|
end
|
29
7
|
|
30
8
|
appraise "rails60" do
|
31
|
-
gem "mocha",
|
9
|
+
gem "mocha", "~> 1.0", require: false
|
32
10
|
gem "rails", "~>5.2.0"
|
33
|
-
gem "fastthread", :
|
34
|
-
gem "passenger"
|
11
|
+
gem "fastthread", github: "zoltankiss/fastthread", platforms: :mri_20
|
12
|
+
gem "passenger"
|
35
13
|
end
|
36
14
|
|
37
15
|
appraise "rails61" do
|
38
|
-
gem "mocha", "~> 1.0", :
|
16
|
+
gem "mocha", "~> 1.0", require: false
|
39
17
|
gem "rails", "~>5.2.0"
|
40
|
-
gem "fastthread", :
|
41
|
-
gem "passenger"
|
18
|
+
gem "fastthread", github: "zoltankiss/fastthread", platforms: :mri_20
|
19
|
+
gem "passenger"
|
42
20
|
end
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
== 4.0.1 (2022-03-06)
|
2
|
+
|
3
|
+
* Fix YAML alias support in `vanity.yml` (@frostmark)
|
4
|
+
|
5
|
+
== 4.0.0 (2022-03-03)
|
6
|
+
|
7
|
+
* Drop support for Ruby < 2.5 (@frostmark)
|
8
|
+
* Drop support for Rails < 5.2 (@bensheldon)
|
9
|
+
|
10
|
+
== 3.1.0 (2022-01-29)
|
11
|
+
|
12
|
+
* Invoke on_assignment callback after assignment is stored in database; add global on_assignment callback (@frostmark)
|
13
|
+
|
1
14
|
== 3.0.2 (2022-01-27)
|
2
15
|
|
3
16
|
* Fix AbTest#alternative_for to always prefer persisted participants (@tgrathwell)
|
data/Gemfile
CHANGED
@@ -9,20 +9,20 @@ gemspec development_group: :test
|
|
9
9
|
gem "rack"
|
10
10
|
|
11
11
|
# Persistence
|
12
|
+
gem "mongo", "~> 2.1"
|
12
13
|
gem "redis", ">= 3.2.1"
|
13
14
|
gem "redis-namespace", ">= 1.1.0"
|
14
|
-
gem "mongo", "~> 2.1"
|
15
15
|
|
16
16
|
# Math libraries
|
17
17
|
gem "integration", "<= 0.1.0"
|
18
18
|
gem "rubystats", ">= 0.2.5"
|
19
19
|
|
20
20
|
# APIs
|
21
|
-
gem "garb", "< 0.9.2", :
|
21
|
+
gem "garb", "< 0.9.2", require: false # API changes at this version
|
22
22
|
|
23
23
|
platform :ruby do
|
24
|
-
gem "sqlite3", "~> 1.3.10"
|
25
24
|
gem "jekyll", "~> 2.5.3"
|
25
|
+
gem "sqlite3", "~> 1.3.10"
|
26
26
|
end
|
27
27
|
|
28
28
|
platform :jruby do
|
@@ -34,4 +34,8 @@ group :development do
|
|
34
34
|
gem "rake"
|
35
35
|
gem "RedCloth"
|
36
36
|
gem "yard"
|
37
|
+
|
38
|
+
gem "rubocop"
|
39
|
+
gem "rubocop-performance"
|
40
|
+
gem "rubocop-rspec"
|
37
41
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vanity (
|
4
|
+
vanity (4.0.1)
|
5
5
|
i18n
|
6
6
|
|
7
7
|
GEM
|
@@ -19,6 +19,7 @@ GEM
|
|
19
19
|
bundler
|
20
20
|
rake
|
21
21
|
thor (>= 0.14.0)
|
22
|
+
ast (2.4.2)
|
22
23
|
blankslate (2.1.2.4)
|
23
24
|
bson (4.0.2)
|
24
25
|
bson (4.0.2-java)
|
@@ -43,7 +44,7 @@ GEM
|
|
43
44
|
activesupport (>= 2.2.0)
|
44
45
|
crack (>= 0.1.6)
|
45
46
|
hitimes (1.2.2)
|
46
|
-
i18n (1.
|
47
|
+
i18n (1.10.0)
|
47
48
|
concurrent-ruby (~> 1.0)
|
48
49
|
integration (0.1.0)
|
49
50
|
jdbc-sqlite3 (3.8.7)
|
@@ -81,6 +82,9 @@ GEM
|
|
81
82
|
minitest (4.7.5)
|
82
83
|
mongo (2.2.3)
|
83
84
|
bson (~> 4.0)
|
85
|
+
parallel (1.21.0)
|
86
|
+
parser (3.1.0.0)
|
87
|
+
ast (~> 2.4.1)
|
84
88
|
parslet (1.5.0)
|
85
89
|
blankslate (~> 2.0)
|
86
90
|
posix-spawn (0.3.11)
|
@@ -97,14 +101,34 @@ GEM
|
|
97
101
|
posix-spawn (~> 0.3.6)
|
98
102
|
yajl-ruby (~> 1.2.0)
|
99
103
|
rack (1.1.3)
|
104
|
+
rainbow (3.1.1)
|
100
105
|
rake (13.0.6)
|
101
106
|
rb-fsevent (0.9.4)
|
102
107
|
rb-inotify (0.9.5)
|
103
108
|
ffi (>= 0.5.0)
|
104
|
-
redcarpet (3.
|
109
|
+
redcarpet (3.5.1)
|
105
110
|
redis (4.0.3)
|
106
111
|
redis-namespace (1.6.0)
|
107
112
|
redis (>= 3.0.4)
|
113
|
+
regexp_parser (2.2.1)
|
114
|
+
rexml (3.2.5)
|
115
|
+
rubocop (1.25.1)
|
116
|
+
parallel (~> 1.10)
|
117
|
+
parser (>= 3.1.0.0)
|
118
|
+
rainbow (>= 2.2.2, < 4.0)
|
119
|
+
regexp_parser (>= 1.8, < 3.0)
|
120
|
+
rexml
|
121
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
122
|
+
ruby-progressbar (~> 1.7)
|
123
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
124
|
+
rubocop-ast (1.15.2)
|
125
|
+
parser (>= 3.0.1.1)
|
126
|
+
rubocop-performance (1.13.2)
|
127
|
+
rubocop (>= 1.7.0, < 2.0)
|
128
|
+
rubocop-ast (>= 0.4.0)
|
129
|
+
rubocop-rspec (2.8.0)
|
130
|
+
rubocop (~> 1.19)
|
131
|
+
ruby-progressbar (1.11.0)
|
108
132
|
rubystats (0.2.5)
|
109
133
|
safe_yaml (1.0.4)
|
110
134
|
sass (3.4.13)
|
@@ -118,6 +142,7 @@ GEM
|
|
118
142
|
hitimes
|
119
143
|
toml (0.1.2)
|
120
144
|
parslet (~> 1.5.0)
|
145
|
+
unicode-display_width (2.1.0)
|
121
146
|
webmock (1.8.0)
|
122
147
|
addressable (>= 2.2.7)
|
123
148
|
crack (>= 0.1.7)
|
@@ -145,6 +170,9 @@ DEPENDENCIES
|
|
145
170
|
rake
|
146
171
|
redis (>= 3.2.1)
|
147
172
|
redis-namespace (>= 1.1.0)
|
173
|
+
rubocop
|
174
|
+
rubocop-performance
|
175
|
+
rubocop-rspec
|
148
176
|
rubystats (>= 0.2.5)
|
149
177
|
sqlite3 (~> 1.3.10)
|
150
178
|
timecop
|
@@ -153,4 +181,4 @@ DEPENDENCIES
|
|
153
181
|
yard
|
154
182
|
|
155
183
|
BUNDLED WITH
|
156
|
-
1.17.
|
184
|
+
1.17.3
|
data/README.md
CHANGED
@@ -380,15 +380,10 @@ your view no participants will be recorded.
|
|
380
380
|
|
381
381
|
Here's what's tested and known to work:
|
382
382
|
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
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
|
383
|
+
Rails: 5.2+
|
384
|
+
Ruby: 2.5+
|
385
|
+
JRuby: 9.1+
|
386
|
+
Persistence: Redis (redis-rb >= 3.2.1), Mongo, ActiveRecord
|
392
387
|
|
393
388
|
## Testing
|
394
389
|
|
data/Rakefile
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
require "rake/testtask"
|
2
2
|
require "bundler/gem_tasks"
|
3
3
|
|
4
|
-
|
5
4
|
# -- Testing stuff --
|
6
5
|
|
7
6
|
desc "Test everything"
|
8
|
-
task "test:all"=>"test:adapters"
|
7
|
+
task "test:all" => "test:adapters"
|
9
8
|
|
10
9
|
# Ruby versions we're testing with.
|
11
10
|
RUBIES = %w{1.9.3 2.0.0 jruby-1.7.13}
|
@@ -19,7 +18,7 @@ RUBIES = %w{1.9.3 2.0.0 jruby-1.7.13}
|
|
19
18
|
# Gemfile. If anything goes south you can always wipe these gemsets or uninstall
|
20
19
|
# these Rubies and start over.
|
21
20
|
desc "Test using multiple versions of Ruby"
|
22
|
-
task "test:rubies", :ruby do |
|
21
|
+
task "test:rubies", :ruby do |_t, args|
|
23
22
|
rubies = args.ruby ? [args.ruby] : RUBIES
|
24
23
|
rubies.each do |ruby|
|
25
24
|
puts "** Setup #{ruby}"
|
@@ -49,18 +48,17 @@ end
|
|
49
48
|
ADAPTERS = %w{redis mongodb active_record}
|
50
49
|
|
51
50
|
desc "Test using different back-ends"
|
52
|
-
task "test:adapters", :adapter do |
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
rescue LoadError
|
62
|
-
warn "The appraisal gem must be available"
|
51
|
+
task "test:adapters", :adapter do |_t, args|
|
52
|
+
# Make sure we have appraisal installed and available
|
53
|
+
require "appraisal"
|
54
|
+
|
55
|
+
adapters = args.adapter ? [args.adapter] : ADAPTERS
|
56
|
+
adapters.each do |adapter|
|
57
|
+
puts "** Testing #{adapter} adapter"
|
58
|
+
sh "bundle exec appraisal rake test DB=#{adapter} #{'--trace' if Rake.application.options.trace}"
|
63
59
|
end
|
60
|
+
rescue LoadError
|
61
|
+
warn "The appraisal gem must be available"
|
64
62
|
end
|
65
63
|
|
66
64
|
# Run the test suit.
|
@@ -72,29 +70,27 @@ Rake::TestTask.new(:test) do |task|
|
|
72
70
|
task.warning = false
|
73
71
|
end
|
74
72
|
|
75
|
-
task :
|
73
|
+
task default: :test
|
76
74
|
desc "Run all tests"
|
77
75
|
|
78
76
|
task(:clobber) { rm_rf "tmp" }
|
79
77
|
|
80
|
-
|
81
78
|
# -- Documenting stuff -- #TODO make sure works under 1.9/2.0
|
82
79
|
|
83
80
|
desc "Jekyll generates the main documentation (sans API)"
|
84
81
|
task(:jekyll) { sh "jekyll build -s doc -d html" }
|
85
82
|
|
86
83
|
desc "Create documentation in docs directory"
|
87
|
-
task :
|
84
|
+
task docs: [:jekyll]
|
88
85
|
|
89
86
|
desc "Remove temporary files and directories"
|
90
87
|
task(:clobber) { rm_rf "html" }
|
91
88
|
|
92
89
|
desc "Publish documentation to vanity.labnotes.org via Github Pages on gh-pages git branch"
|
93
|
-
task :
|
90
|
+
task publish: [:clobber, :docs] do
|
94
91
|
# TODO
|
95
92
|
end
|
96
93
|
|
97
|
-
|
98
94
|
# -- Misc --
|
99
95
|
|
100
96
|
task :report do
|
@@ -111,28 +107,33 @@ task :report do
|
|
111
107
|
# Treatment B 189 28 14.81% -1.13
|
112
108
|
# Treatment C 188 61 32.45% 2.94
|
113
109
|
Vanity.playground.experiment(:null_abc).instance_eval do
|
114
|
-
fake nil=>[182,35], :red=>[180,45], :green=>[189,28], :blue=>[188,61]
|
110
|
+
fake nil => [182, 35], :red => [180, 45], :green => [189, 28], :blue => [188, 61]
|
115
111
|
@created_at = (Date.today - 40).to_time
|
116
112
|
@completed_at = (Date.today - 35).to_time
|
117
113
|
end
|
118
114
|
|
119
115
|
Vanity.playground.experiment(:age_and_zipcode).instance_eval do
|
120
|
-
fake false=>[80,35], true=>[84,32]
|
116
|
+
fake false => [80, 35], true => [84, 32]
|
121
117
|
@created_at = (Date.today - 30).to_time
|
122
118
|
@completed_at = (Date.today - 15).to_time
|
123
119
|
end
|
124
120
|
|
125
121
|
Vanity.context = Object.new
|
126
|
-
Vanity.context.instance_eval
|
122
|
+
Vanity.context.instance_eval do
|
123
|
+
def vanity_identity
|
124
|
+
0
|
125
|
+
end
|
126
|
+
end
|
127
127
|
signups = 50
|
128
128
|
(Date.today - 90..Date.today).each do |date|
|
129
129
|
Timecop.travel date do
|
130
|
-
signups += rand(
|
130
|
+
signups += rand(-5..9)
|
131
131
|
Vanity.playground.track! :signups, signups
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
cheers
|
135
|
+
cheers = 0
|
136
|
+
yawns = 0
|
136
137
|
(Date.today - 80..Date.today).each do |date|
|
137
138
|
Timecop.travel date do
|
138
139
|
cheers = cheers - 5 + rand(20)
|
data/bin/vanity
CHANGED
@@ -35,7 +35,7 @@ parser = OptionParser.new("", 24, " ") do |opts|
|
|
35
35
|
puts opts.to_s.gsub(/^.*DEPRECATED.*$/s, '')
|
36
36
|
exit
|
37
37
|
end
|
38
|
-
opts.on_tail "-v", "--version", "Show version"
|
38
|
+
opts.on_tail "-v", "--version", "Show version" do
|
39
39
|
puts "Vanity #{Vanity::Version::STRING}"
|
40
40
|
exit
|
41
41
|
end
|
data/doc/configuring.textile
CHANGED
@@ -51,6 +51,7 @@ Available configuration options are:
|
|
51
51
|
| cookie_path | The path of the cookie | @nil@ |
|
52
52
|
| cookie_secure | The secure (ssl-only) parameter of the cookie. | @false@ |
|
53
53
|
| cookie_httponly | The httponly parameter of the cookie | @false@ |
|
54
|
+
| on_assignment | A proc that called when a new assignment is made for the experiment | @nil@ |
|
54
55
|
|
55
56
|
When "running under Rails":rails.html, Vanity defaults to using the Rails logger, locates the load_path relative to Rails root, uses the @config/vanity.yml@ configuration file (if present) and turns collection on only in production mode.
|
56
57
|
|
data/gemfiles/rails52.gemfile
CHANGED
@@ -3,26 +3,29 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "rack"
|
6
|
+
gem "mongo", "~> 2.1"
|
6
7
|
gem "redis", ">= 3.2.1"
|
7
8
|
gem "redis-namespace", ">= 1.1.0"
|
8
|
-
gem "mongo", "~> 2.1"
|
9
9
|
gem "integration", "<= 0.1.0"
|
10
10
|
gem "rubystats", ">= 0.2.5"
|
11
11
|
gem "garb", "< 0.9.2", require: false
|
12
12
|
gem "mocha", "~> 1.0", require: false
|
13
13
|
gem "rails", "~>5.2.0"
|
14
14
|
gem "fastthread", platforms: :mri_20, git: "https://github.com/zoltankiss/fastthread.git"
|
15
|
-
gem "passenger"
|
15
|
+
gem "passenger"
|
16
16
|
|
17
17
|
group :development do
|
18
18
|
gem "rake"
|
19
19
|
gem "RedCloth"
|
20
20
|
gem "yard"
|
21
|
+
gem "rubocop"
|
22
|
+
gem "rubocop-performance"
|
23
|
+
gem "rubocop-rspec"
|
21
24
|
end
|
22
25
|
|
23
26
|
platforms :ruby do
|
24
|
-
gem "sqlite3", "~> 1.3.10"
|
25
27
|
gem "jekyll", "~> 2.5.3"
|
28
|
+
gem "sqlite3", "~> 1.3.10"
|
26
29
|
end
|
27
30
|
|
28
31
|
platforms :jruby do
|