split_tester 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/split_tester.rb +5 -1
- data/lib/split_tester/caching.rb +26 -2
- data/split_tester.gemspec +1 -1
- metadata +5 -5
data/Rakefile
CHANGED
data/lib/split_tester.rb
CHANGED
@@ -24,7 +24,7 @@ module SplitTester
|
|
24
24
|
I18n.load_path += Dir[Rails.root.join('test', 'split', '*', 'locale.{rb,yml}')]
|
25
25
|
|
26
26
|
@@preprocessed_pathsets = begin
|
27
|
-
|
27
|
+
self.test_keys.inject({}) do |pathsets, slug|
|
28
28
|
path = custom_view_path(slug)
|
29
29
|
pathsets[path] = ActionView::Base.process_view_paths(path).first
|
30
30
|
pathsets
|
@@ -46,6 +46,10 @@ module SplitTester
|
|
46
46
|
@@split_test_map
|
47
47
|
end
|
48
48
|
|
49
|
+
def self.test_keys
|
50
|
+
@test_keys ||= SPLIT_TESTS.keys.reject { |k| k == 'BASELINE' }
|
51
|
+
end
|
52
|
+
|
49
53
|
def self.preprocessed_pathsets
|
50
54
|
@@preprocessed_pathsets
|
51
55
|
end
|
data/lib/split_tester/caching.rb
CHANGED
@@ -4,10 +4,34 @@ module SplitTester #:nodoc:
|
|
4
4
|
module Caching
|
5
5
|
def self.included(base)
|
6
6
|
base.class_eval {
|
7
|
-
def fragment_cache_key(key)
|
8
|
-
namespace
|
7
|
+
def fragment_cache_key(key, namespace = nil)
|
8
|
+
namespace ||= is_split_test? ? "views-split-#{current_split_test_key}" : :views
|
9
9
|
ActiveSupport::Cache.expand_cache_key(key.is_a?(Hash) ? url_for(key).split("://").last : key, namespace)
|
10
10
|
end
|
11
|
+
|
12
|
+
def expire_fragment(key, options = nil)
|
13
|
+
return unless cache_configured?
|
14
|
+
key = fragment_cache_key(key, :views) unless key.is_a?(Regexp)
|
15
|
+
message = nil
|
16
|
+
|
17
|
+
instrument_fragment_cache :expire_fragment, key do
|
18
|
+
if key.is_a?(Regexp)
|
19
|
+
cache_store.delete_matched(key, options)
|
20
|
+
else
|
21
|
+
cache_store.delete(key, options)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
unless key.is_a?(Regexp)
|
26
|
+
original_key = key.dup
|
27
|
+
SplitTester::Base.test_keys.each do |k,v|
|
28
|
+
key = original_key.sub('views/', "views-split-#{k}/")
|
29
|
+
instrument_fragment_cache :expire_fragment, key do
|
30
|
+
cache_store.delete(key, options)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
11
35
|
}
|
12
36
|
end
|
13
37
|
end
|
data/split_tester.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.platform = Gem::Platform::RUBY
|
3
3
|
s.name = 'split_tester'
|
4
|
-
s.version = '0.
|
4
|
+
s.version = '0.4'
|
5
5
|
s.summary = 'Provides A/B split testing functionality for Rails'
|
6
6
|
s.description = 'Split Tester provides support for A/B Split testing your pages with integration into Google Analytics.'
|
7
7
|
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: split_tester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 4
|
9
|
+
version: "0.4"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeremy Hubert
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements: []
|
79
79
|
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.4.2
|
82
82
|
signing_key:
|
83
83
|
specification_version: 3
|
84
84
|
summary: Provides A/B split testing functionality for Rails
|