laboratory 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/.github/workflows/continuous-integration.yml +33 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/laboratory/config.rb +9 -11
- data/lib/laboratory/experiment.rb +3 -3
- data/lib/laboratory/version.rb +1 -1
- data/lib/laboratory.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55e19407d1d182b0d5f0a9530b0b18b739d0773c17755373d46309c78af10c99
|
4
|
+
data.tar.gz: 5581f4f721d03c9608b17c6e028766c7642d42139e91489729c301fa1d0d6335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 597b0b0be8cd204955109ede2e49d7a7c35b14380e6bf60fa93b8332ec2bdb19dd20b3067b1f21e5a37119115753d94f7b81c9ae54a67b4fa01b62c9fa510814
|
7
|
+
data.tar.gz: 9716b7aa6e505c7082517c77cdf13647b7d02c6107ebf5e2fcc10d89837b429a8fe96808105b06849359f0d714ab846a2da9b35b10e86d791330d109f6ee1ddd
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Continuous Integration
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
ruby_unit_tests:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
env:
|
14
|
+
RAILS_ENV: test
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v1
|
18
|
+
- uses: actions/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: '2.6.x'
|
21
|
+
|
22
|
+
- run: gem install bundler -v 2.1.4
|
23
|
+
|
24
|
+
- uses: actions/cache@v1
|
25
|
+
with:
|
26
|
+
path: vendor/bundle
|
27
|
+
key: v1-bundle-cache-${{ hashFiles('**/Gemfile.lock') }}
|
28
|
+
restore-keys: |
|
29
|
+
v1-bundle-cache-
|
30
|
+
|
31
|
+
- run: bundle config set path 'vendor/bundle'
|
32
|
+
- run: bundle install --jobs 4 --retry 3
|
33
|
+
- run: bundle exec rspec spec
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -287,8 +287,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
287
287
|
|
288
288
|
### Todo List
|
289
289
|
|
290
|
-
- [ ] Test in
|
291
|
-
- [ ]
|
290
|
+
- [ ] Test performance in an A/A test on production
|
291
|
+
- [ ] Use for an A/B test on production
|
292
292
|
|
293
293
|
## Contributing
|
294
294
|
|
data/lib/laboratory/config.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
module Laboratory
|
2
2
|
class Config
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
)
|
3
|
+
attr_accessor(
|
4
|
+
:current_user_id,
|
5
|
+
:adapter,
|
6
|
+
:actor,
|
7
|
+
:on_assignment_to_variant,
|
8
|
+
:on_event_recorded
|
9
|
+
)
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
end
|
11
|
+
def current_user
|
12
|
+
@current_user ||= Laboratory::User.new(id: current_user_id)
|
15
13
|
end
|
16
14
|
end
|
17
15
|
end
|
@@ -110,7 +110,7 @@ module Laboratory
|
|
110
110
|
variant = algorithm.pick!(variants)
|
111
111
|
variant.add_participant(user)
|
112
112
|
|
113
|
-
Laboratory
|
113
|
+
Laboratory.config.on_assignment_to_variant&.call(self, variant, user)
|
114
114
|
|
115
115
|
save
|
116
116
|
variant
|
@@ -124,7 +124,7 @@ module Laboratory
|
|
124
124
|
variant = variants.find { |s| s.id == variant_id }
|
125
125
|
variant.add_participant(user)
|
126
126
|
|
127
|
-
Laboratory
|
127
|
+
Laboratory.config.on_assignment_to_variant&.call(self, variant, user)
|
128
128
|
|
129
129
|
save
|
130
130
|
variant
|
@@ -147,7 +147,7 @@ module Laboratory
|
|
147
147
|
|
148
148
|
event.event_recordings << event_recording
|
149
149
|
|
150
|
-
Laboratory
|
150
|
+
Laboratory.config.on_event_recorded&.call(self, variant, user, event)
|
151
151
|
|
152
152
|
save
|
153
153
|
event_recording
|
data/lib/laboratory/version.rb
CHANGED
data/lib/laboratory.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: laboratory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niall Paterson
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/workflows/continuous-integration.yml"
|
90
91
|
- ".github/workflows/linters.yml"
|
91
92
|
- ".gitignore"
|
92
93
|
- ".rspec"
|