ab-split 1.0.0 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72275edbc6ab7af7f773bc30f4c585a6166e94ccdd721f2c15c497e9c594f8d8
4
- data.tar.gz: 241fb4233f417cb9a74e8b1f9e49bd96d33178b594c3de98dd33f162b175833a
3
+ metadata.gz: 47759e39db6fc259f34e839328343c53b7ca8e1eb824d58e6f2ddc900a170ea6
4
+ data.tar.gz: ab97c9dab5dbe1161def9884f9b89028c6f14f8e4c5e8eb4b0d9fc6f92621b16
5
5
  SHA512:
6
- metadata.gz: defdeceeae8355a5041848c5336908cc29951feb4faaae3067c135d148b5000b9e7f8de4576606f8aaf7492dc8117d65b1409fdc0309725d8d341394e5463437
7
- data.tar.gz: 8a319c4a7b15a60dd9ae74e46d237344c8d384269fdddc455d44fc107ca50ffbf565ad7adccb422b67483c912c75525ef1fee43ae742ffc7d19c0322f018e92a
6
+ metadata.gz: b3e45a591fa2c72bcbebd4ea5d2900ede17adba222f683477baaf3a2b5da0c3826e0cc3e24459eb5610e02e086ae4ac625f90914501c2442fa73b69057127e2e
7
+ data.tar.gz: 878332197608d922d8bc794a5506cbe26190963f145009cf7346bae968ec372ff52dffdcb78ff00b5670908a21ab1ea9667f09a3777b593c9ee48e3214e7194d
@@ -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'
@@ -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 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
@@ -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
 
@@ -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)
@@ -2,6 +2,6 @@
2
2
  module Split
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- PATCH = 0
5
+ PATCH = 1
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.1
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: