ab_panel 0.3.1 → 0.3.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
  SHA1:
3
- metadata.gz: e9b7d7fb5d5ab3835d06ffbe6d30c994c55b329d
4
- data.tar.gz: 3b11bb8f4e3ffcc50c35a1c989821643d1cc8d42
3
+ metadata.gz: d77ef41ffb6e4273d6ec88ab00fc960fc9a6c88e
4
+ data.tar.gz: 9e8850ac87741533224b29b34d00350f5ee8473a
5
5
  SHA512:
6
- metadata.gz: 771553f411e57c0ac8032dd8526b50045d4e62cbd1e3103567e965121c80c00932c08b574515a3ece951174250e56a71ea254705ae81fac193e5890ac9bdd3b9
7
- data.tar.gz: 0237e1a52e4636a920564469cb2c92a8564f41553f99deded950fef1fa2ce99171ed1573beb34c9b2a86967419fe3da812989b5ccc7487b762b5514be05fc483
6
+ metadata.gz: 4e50d0ebfb5facc8e0ea8216913e61a716470b54bf0a92d9a83e2616c726f702742a7a381cfb102a8c8b9eb1fff2ddadd0f7310e68a388e1c8a2bef7d66891cb
7
+ data.tar.gz: 29e00ce3c3b0e9a2a8927072970b9432ea2cf415167ddd4f9da490da17bc05dc6127705edc162a463e207b22cc4607c6202a32e0dc9073269f3ffb87fe43a819
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
2
  script: 'bundle exec rspec spec'
3
3
  rvm:
4
- - 1.9.3
5
- - 2.0.0
4
+ - 2.1.5
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency "fakeweb"
25
25
  spec.add_development_dependency "rspec"
26
- spec.add_development_dependency "debugger"
26
+ spec.add_development_dependency "byebug"
27
27
 
28
28
  spec.add_runtime_dependency "mixpanel"
29
29
  end
@@ -19,7 +19,7 @@ module AbPanel
19
19
  end
20
20
 
21
21
  def conditions
22
- @conditions ||= assign_conditions!
22
+ Thread.current[:ab_panel_conditions] ||= assign_conditions!
23
23
  end
24
24
 
25
25
  # Set the experiment's conditions.
@@ -28,7 +28,7 @@ module AbPanel
28
28
  # the session.
29
29
  def conditions=(custom_conditions)
30
30
  return conditions unless custom_conditions
31
- @conditions = assign_conditions! custom_conditions
31
+ Thread.current[:ab_panel_conditions] = assign_conditions! custom_conditions
32
32
  end
33
33
 
34
34
  def experiments
@@ -44,18 +44,18 @@ module AbPanel
44
44
  end
45
45
 
46
46
  def properties
47
- @env[:properties]
47
+ env[:properties]
48
48
  end
49
49
 
50
50
  def env
51
- @env ||= {
51
+ Thread.current[:ab_panel_env] ||= {
52
52
  'conditions' => conditions
53
53
  }
54
54
  end
55
55
 
56
56
  def reset!
57
- @env = nil
58
- @conditions = nil
57
+ Thread.current[:ab_panel_env] = nil
58
+ Thread.current[:ab_panel_conditions] = nil
59
59
  end
60
60
 
61
61
  def set_env(key, value)
@@ -67,7 +67,7 @@ module AbPanel
67
67
  end
68
68
 
69
69
  def funnels=(funnels)
70
- env['funnels'] = funnels
70
+ Thread.current['ab_panel_env']['funnels'] = funnels
71
71
  end
72
72
 
73
73
  def add_funnel(funnel)
@@ -1,3 +1,3 @@
1
1
  module AbPanel
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -88,4 +88,12 @@ describe AbPanel do
88
88
  AbPanel.funnels.to_a.should == funnels.to_a
89
89
  end
90
90
  end
91
+
92
+ describe 'thread-safety' do
93
+ it 'should set be safe' do
94
+ AbPanel.set_env(:test, 'a')
95
+ Thread.new { AbPanel.set_env(:test, 'b') }.join
96
+ expect(AbPanel.env[:test]).to eq 'a'
97
+ end
98
+ end
91
99
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ab_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wouter de Vos
@@ -10,104 +10,104 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-11 00:00:00.000000000 Z
13
+ date: 2015-08-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '1.3'
22
22
  type: :development
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: '1.3'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rails
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: '3.2'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '3.2'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rake
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: fakeweb
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rspec
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
- name: debugger
86
+ name: byebug
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: mixpanel
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  type: :runtime
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  description: Run A/B test experiments on your Rails 3+ site using Mixpanel as a backend.
@@ -119,8 +119,8 @@ executables: []
119
119
  extensions: []
120
120
  extra_rdoc_files: []
121
121
  files:
122
- - .gitignore
123
- - .travis.yml
122
+ - ".gitignore"
123
+ - ".travis.yml"
124
124
  - Gemfile
125
125
  - LICENSE.txt
126
126
  - README.md
@@ -218,17 +218,17 @@ require_paths:
218
218
  - lib
219
219
  required_ruby_version: !ruby/object:Gem::Requirement
220
220
  requirements:
221
- - - '>='
221
+ - - ">="
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  requirements:
226
- - - '>='
226
+ - - ">="
227
227
  - !ruby/object:Gem::Version
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubyforge_project:
231
- rubygems_version: 2.0.14
231
+ rubygems_version: 2.2.2
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: Run A/B test experiments on your Rails 3+ site using Mixpanel as a backend.