experimental 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/app/models/experimental/experiment.rb +1 -1
- data/lib/experimental/controller_actions.rb +1 -0
- data/lib/experimental/loader.rb +3 -1
- data/lib/experimental/overrides.rb +14 -1
- data/lib/experimental/test.rb +10 -1
- data/lib/experimental/version.rb +1 -1
- data/lib/generators/experimental/templates/create_experiments_table.rb +1 -0
- metadata +15 -99
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MDVhMDA3ZDg3YzI1ZjY5ZGI3ZjMzYzU5YWViYWIwZTVhMzg5Mjg2ZTMxMzAy
|
10
|
-
YjIwYzllY2E3OWMyZTI3NmUwM2JlZGM3ZWU3N2UxOTFjMDU5Yzc1YmJjNGJh
|
11
|
-
NTY0ODhlMWQwMjgzYTRlNGE0YzMwMmUyMWEyYzAzZmFmNzkyYmQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZWNiMzRkYzhmMzU2MmQ3NTA3YjVmOGVjOGZiODI2OTFiNmMwOWIzZDdkMmE2
|
14
|
-
YWQ4MDE2OGIyYjQ4MTU3MzE2NmEyMDcwYmI1NjgxYWJmZjE4ODkwOTVmZTA2
|
15
|
-
YTk0YzM4N2UxZjliMTM5MDdjM2MxODc5YTc1NzBkYzA5MmExZDc=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83c50c67d6dd426e4854405cb9ffdf073501ae5e
|
4
|
+
data.tar.gz: 72a4707f81e9422629f77c972101238f22c31a00
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ee6381fc21a8e59ce7acae502650d4023a3ddb4df2be016497137ceb5876e7256e9d837fcf6b7fb4582336769f369db61ed7c06741d3ca8bb6aaefc2a17624f0
|
7
|
+
data.tar.gz: 33c24ea4e0ef978b55225e474969aa57424ae3bdb122a657fe7445b75426d311846b784f6f646ea17f1195b663a8693ace60c9323219f2237451905244cd8879
|
@@ -5,7 +5,7 @@ module Experimental
|
|
5
5
|
attr_accessible :name, :num_buckets, :notes, :population
|
6
6
|
|
7
7
|
validates_presence_of :name, :num_buckets
|
8
|
-
validates_numericality_of :num_buckets, :greater_than_or_equal_to =>
|
8
|
+
validates_numericality_of :num_buckets, :greater_than_or_equal_to => 1
|
9
9
|
validates_numericality_of :winning_bucket,
|
10
10
|
:greater_than_or_equal_to => 0,
|
11
11
|
:less_than => :num_buckets,
|
data/lib/experimental/loader.rb
CHANGED
@@ -15,7 +15,8 @@ module Experimental
|
|
15
15
|
active = Experimental.experiment_data.map do |name, attributes|
|
16
16
|
experiment = Experimental::Experiment.find_or_initialize_by_name(name)
|
17
17
|
logger.info " * #{experiment.id ? 'updating' : 'creating'} #{name}"
|
18
|
-
|
18
|
+
defaults = {'num_buckets' => nil, 'notes' => nil, 'population' => nil}
|
19
|
+
experiment.assign_attributes(defaults.merge(attributes))
|
19
20
|
experiment.start_date ||= Time.now
|
20
21
|
experiment.tap(&:save!)
|
21
22
|
end
|
@@ -23,6 +24,7 @@ module Experimental
|
|
23
24
|
scope = Experimental::Experiment.in_code
|
24
25
|
scope = scope.where('id NOT IN (?)', active.map(&:id)) unless active.empty?
|
25
26
|
scope.find_each do |experiment|
|
27
|
+
next if experiment.admin?
|
26
28
|
logger.info " * removing #{experiment.name}"
|
27
29
|
experiment.remove
|
28
30
|
end
|
@@ -4,16 +4,27 @@ module Experimental
|
|
4
4
|
@overrides ||= Hash.new do |experiment_overrides, experiment_name|
|
5
5
|
experiment_overrides[experiment_name] = {}
|
6
6
|
end
|
7
|
+
@default_set = false
|
8
|
+
end
|
9
|
+
|
10
|
+
def set_default(value)
|
11
|
+
@default_set = true
|
12
|
+
@default = value
|
7
13
|
end
|
8
14
|
|
9
15
|
def include?(subject, experiment_name)
|
16
|
+
return true if @default_set
|
10
17
|
experiment_name = experiment_name.to_s
|
11
18
|
@overrides.key?(experiment_name) && @overrides[experiment_name].key?(subject)
|
12
19
|
end
|
13
20
|
|
14
21
|
def [](subject, experiment_name)
|
15
22
|
experiment_name = experiment_name.to_s
|
16
|
-
@overrides[experiment_name]
|
23
|
+
if @overrides[experiment_name].key?(subject)
|
24
|
+
@overrides[experiment_name][subject]
|
25
|
+
else
|
26
|
+
@default
|
27
|
+
end
|
17
28
|
end
|
18
29
|
|
19
30
|
def []=(subject, experiment_name, bucket)
|
@@ -23,6 +34,8 @@ module Experimental
|
|
23
34
|
|
24
35
|
def reset
|
25
36
|
@overrides.clear
|
37
|
+
@default_set = false
|
38
|
+
@default = nil
|
26
39
|
end
|
27
40
|
end
|
28
41
|
end
|
data/lib/experimental/test.rb
CHANGED
@@ -10,13 +10,22 @@ module Experimental
|
|
10
10
|
# Calling it again isn't harmful, just unnecessary.
|
11
11
|
def self.initialize
|
12
12
|
return if @initialized
|
13
|
+
@initial_source = Experimental.source
|
13
14
|
Experimental.source = Experimental::Source::Configuration.new
|
14
15
|
@initialized = true
|
15
16
|
end
|
16
17
|
|
17
|
-
# Call this before each test.
|
18
|
+
# Call this before each test. It provides a deterministic default: all
|
19
|
+
# subjects are out of all experiments. Opt subjects into experiments using
|
20
|
+
# #set_experimental_bucket.
|
18
21
|
def self.setup
|
19
22
|
Experimental.overrides.reset
|
23
|
+
Experimental.overrides.set_default(nil)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.teardown
|
27
|
+
Experimental.source = @initial_source
|
28
|
+
@initialized = false
|
20
29
|
end
|
21
30
|
|
22
31
|
# Force the given subject into the given +bucket+ of the given +experiment+.
|
data/lib/experimental/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: experimental
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HowAboutWe.com
|
@@ -10,118 +10,34 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-01-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - <=
|
19
|
+
- - "<="
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '5.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- - <=
|
26
|
+
- - "<="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '5.0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: jquery-rails
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '0'
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: sqlite3
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - ! '>='
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0'
|
50
|
-
type: :development
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - ! '>='
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0'
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: timecop
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - ! '>='
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '0'
|
64
|
-
type: :development
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - ! '>='
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: rspec-rails
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - ! '>='
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '0'
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: activeadmin
|
87
|
-
requirement: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - ! '>='
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0'
|
92
|
-
type: :development
|
93
|
-
prerelease: false
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
requirements:
|
96
|
-
- - ! '>='
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: '0'
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: sass-rails
|
101
|
-
requirement: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ! '>='
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '0'
|
106
|
-
type: :development
|
107
|
-
prerelease: false
|
108
|
-
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
requirements:
|
110
|
-
- - ! '>='
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0'
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: coffee-rails
|
115
|
-
requirement: !ruby/object:Gem::Requirement
|
116
|
-
requirements:
|
117
|
-
- - ! '>='
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0'
|
120
|
-
type: :development
|
121
|
-
prerelease: false
|
122
|
-
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- - ! '>='
|
40
|
+
- - ">="
|
125
41
|
- !ruby/object:Gem::Version
|
126
42
|
version: '0'
|
127
43
|
description: AB Test framework for Rails
|
@@ -131,6 +47,9 @@ executables: []
|
|
131
47
|
extensions: []
|
132
48
|
extra_rdoc_files: []
|
133
49
|
files:
|
50
|
+
- MIT-LICENSE
|
51
|
+
- README.markdown
|
52
|
+
- Rakefile
|
134
53
|
- app/models/experimental/experiment.rb
|
135
54
|
- app/models/experimental/population/default.rb
|
136
55
|
- app/models/experimental/population/filter.rb
|
@@ -141,31 +60,28 @@ files:
|
|
141
60
|
- app/views/experimental/_links.html.erb
|
142
61
|
- app/views/experimental/_new.html.erb
|
143
62
|
- config/routes.rb
|
63
|
+
- lib/experimental.rb
|
144
64
|
- lib/experimental/controller_actions.rb
|
145
65
|
- lib/experimental/engine.rb
|
146
66
|
- lib/experimental/loader.rb
|
147
67
|
- lib/experimental/overrides.rb
|
148
68
|
- lib/experimental/railtie.rb
|
149
69
|
- lib/experimental/rspec_helpers.rb
|
70
|
+
- lib/experimental/source.rb
|
150
71
|
- lib/experimental/source/active_record.rb
|
151
72
|
- lib/experimental/source/base.rb
|
152
73
|
- lib/experimental/source/cache.rb
|
153
74
|
- lib/experimental/source/configuration.rb
|
154
|
-
- lib/experimental/
|
75
|
+
- lib/experimental/test.rb
|
155
76
|
- lib/experimental/test/cucumber.rb
|
156
77
|
- lib/experimental/test/rspec.rb
|
157
78
|
- lib/experimental/test/unit.rb
|
158
|
-
- lib/experimental/test.rb
|
159
79
|
- lib/experimental/version.rb
|
160
|
-
- lib/experimental.rb
|
161
80
|
- lib/generators/experimental/experimental_generator.rb
|
162
81
|
- lib/generators/experimental/templates/create_experiments_table.rb
|
163
82
|
- lib/generators/experimental/templates/experimental.rb
|
164
83
|
- lib/generators/experimental/templates/experiments.yml
|
165
84
|
- lib/tasks/experimental.rake
|
166
|
-
- MIT-LICENSE
|
167
|
-
- Rakefile
|
168
|
-
- README.markdown
|
169
85
|
homepage: https://github.com/howaboutwe/experimental
|
170
86
|
licenses:
|
171
87
|
- MIT
|
@@ -176,17 +92,17 @@ require_paths:
|
|
176
92
|
- lib
|
177
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
178
94
|
requirements:
|
179
|
-
- -
|
95
|
+
- - ">="
|
180
96
|
- !ruby/object:Gem::Version
|
181
97
|
version: '0'
|
182
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
99
|
requirements:
|
184
|
-
- -
|
100
|
+
- - ">="
|
185
101
|
- !ruby/object:Gem::Version
|
186
102
|
version: '0'
|
187
103
|
requirements: []
|
188
104
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.0
|
105
|
+
rubygems_version: 2.2.0
|
190
106
|
signing_key:
|
191
107
|
specification_version: 4
|
192
108
|
summary: Adds support for database-backed AB tests in Rails apps
|