ab-split 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72275edbc6ab7af7f773bc30f4c585a6166e94ccdd721f2c15c497e9c594f8d8
4
- data.tar.gz: 241fb4233f417cb9a74e8b1f9e49bd96d33178b594c3de98dd33f162b175833a
3
+ metadata.gz: bc480d9ca64951caaaf7530faed72be3384e2a217e4eeabc7d3e16be3d15d067
4
+ data.tar.gz: 1242b45c328f3d7e1526660985c496387c242bdbc3adc4364a0a67123f2f6506
5
5
  SHA512:
6
- metadata.gz: defdeceeae8355a5041848c5336908cc29951feb4faaae3067c135d148b5000b9e7f8de4576606f8aaf7492dc8117d65b1409fdc0309725d8d341394e5463437
7
- data.tar.gz: 8a319c4a7b15a60dd9ae74e46d237344c8d384269fdddc455d44fc107ca50ffbf565ad7adccb422b67483c912c75525ef1fee43ae742ffc7d19c0322f018e92a
6
+ metadata.gz: e1016e9680c56ebe41803f0ab7aaeecb4fb8a7dd260a93b511a6b7e835971de651b7f27ddeba6546e130f12ff5f9491820295d90537280573c910f8fb3937886
7
+ data.tar.gz: '058a3e4f741fa6e6f9adec8815f9d4b175652871b47bfbe382733336e72991557659b6629fdcd2075e6a25db865726f18aa21d59455c93fb6ba544d39a0042c6'
data/ab-split.gemspec CHANGED
@@ -8,18 +8,18 @@ Gem::Specification.new do |s|
8
8
  s.version = Split::VERSION
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.licenses = ['MIT']
11
- s.authors = ["aibotyu"]
12
- s.email = ["284894567@qq.com"]
13
- s.homepage = "https://github.com/WeiGangqiang/split"
11
+ s.authors = ["aibotyu"]
12
+ s.email = ["284894567@qq.com"]
13
+ s.homepage = "https://github.com/splitrb/split"
14
14
  s.summary = "Rack based split testing framework"
15
15
 
16
16
  s.metadata = {
17
- "homepage_uri" => "https://github.com/WeiGangqiang/split",
18
- "changelog_uri" => "https://github.com/WeiGangqiang/split/blob/master/CHANGELOG.md",
19
- "source_code_uri" => "https://github.com/WeiGangqiang/split",
20
- "bug_tracker_uri" => "https://github.com/WeiGangqiang/split/issues",
21
- "wiki_uri" => "https://github.com/WeiGangqiang/split/wiki",
22
- "mailing_list_uri" => "https://github.com/WeiGangqiang/split/split-ruby"
17
+ "homepage_uri" => "https://github.com/splitrb/split",
18
+ "changelog_uri" => "https://github.com/splitrb/split/blob/master/CHANGELOG.md",
19
+ "source_code_uri" => "https://github.com/splitrb/split",
20
+ "bug_tracker_uri" => "https://github.com/splitrb/split/issues",
21
+ "wiki_uri" => "https://github.com/splitrb/split/wiki",
22
+ "mailing_list_uri" => "https://groups.google.com/d/forum/split-ruby"
23
23
  }
24
24
 
25
25
  s.required_ruby_version = '>= 1.9.3'
data/lib/split/helper.rb CHANGED
@@ -9,7 +9,6 @@ module Split
9
9
  begin
10
10
  experiment = ExperimentCatalog.find_or_initialize(metric_descriptor, control, *alternatives)
11
11
  alternative = if Split.configuration.enabled && !exclude_visitor?
12
- experiment.save
13
12
  raise(Split::InvalidExperimentsFormatError) unless (Split.configuration.experiments || {}).fetch(experiment.name.to_sym, {})[:combined_experiments].nil?
14
13
  trial = Trial.new(:user => ab_user, :experiment => experiment,
15
14
  :override => override_alternative(experiment.name), :exclude => exclude_visitor?,
@@ -39,6 +38,11 @@ module Split
39
38
  end
40
39
  end
41
40
 
41
+ def self.ab_test_config(metric_descriptor, control = nil, *alternatives)
42
+ experiment = ExperimentCatalog.find_or_initialize(metric_descriptor, control, *alternatives)
43
+ experiment.save
44
+ end
45
+
42
46
  def reset!(experiment)
43
47
  ab_user.delete(experiment.key)
44
48
  end
data/lib/split/trial.rb CHANGED
@@ -49,7 +49,7 @@ module Split
49
49
  # method is guaranteed to only run once, and will skip the alternative choosing process if run
50
50
  # a second time.
51
51
  def choose!(context = nil)
52
- @user.cleanup_old_experiments!
52
+ @user.cleanup_old_experiments! self.experiment
53
53
  # Only run the process once
54
54
  return alternative if @alternative_choosen
55
55
 
data/lib/split/user.rb CHANGED
@@ -12,10 +12,10 @@ module Split
12
12
  @cleaned_up = false
13
13
  end
14
14
 
15
- def cleanup_old_experiments!
15
+ def cleanup_old_experiments! experiment
16
16
  return if @cleaned_up
17
17
  keys_without_finished(user.keys).each do |key|
18
- experiment = ExperimentCatalog.find key_without_version(key)
18
+ return unless experiment.name == key_without_version(key)
19
19
  if experiment.nil? || experiment.has_winner? || experiment.start_time.nil?
20
20
  user.delete key
21
21
  user.delete Experiment.finished_key(key)
data/lib/split/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
  module Split
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- PATCH = 0
5
+ PATCH = 2
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ab-split
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - aibotyu
@@ -263,16 +263,16 @@ files:
263
263
  - spec/support/cookies_mock.rb
264
264
  - spec/trial_spec.rb
265
265
  - spec/user_spec.rb
266
- homepage: https://github.com/WeiGangqiang/split
266
+ homepage: https://github.com/splitrb/split
267
267
  licenses:
268
268
  - MIT
269
269
  metadata:
270
- homepage_uri: https://github.com/WeiGangqiang/split
271
- changelog_uri: https://github.com/WeiGangqiang/split/blob/master/CHANGELOG.md
272
- source_code_uri: https://github.com/WeiGangqiang/split
273
- bug_tracker_uri: https://github.com/WeiGangqiang/split/issues
274
- wiki_uri: https://github.com/WeiGangqiang/split/wiki
275
- mailing_list_uri: https://github.com/WeiGangqiang/split/split-ruby
270
+ homepage_uri: https://github.com/splitrb/split
271
+ changelog_uri: https://github.com/splitrb/split/blob/master/CHANGELOG.md
272
+ source_code_uri: https://github.com/splitrb/split
273
+ bug_tracker_uri: https://github.com/splitrb/split/issues
274
+ wiki_uri: https://github.com/splitrb/split/wiki
275
+ mailing_list_uri: https://groups.google.com/d/forum/split-ruby
276
276
  post_install_message:
277
277
  rdoc_options: []
278
278
  require_paths: