split_cacheable 1.0.4 → 1.2.0

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: 88bf6a45b6ca1479a616341ae2e5ac7ed63c2eee
4
- data.tar.gz: c091304482e6a064c71c9759e615cf4eae60a157
3
+ metadata.gz: 368c9295e1d66cf2cc485447c8fceb6447e9513b
4
+ data.tar.gz: b57ff20ea387090b991be0568ed2e8c0fecc09c9
5
5
  SHA512:
6
- metadata.gz: f989aae4a469c7aa4c5fc3a0f7503b7b6fdadfb27befef780c55cc3d2e88f4f14a78ab92de4f72fbb91b5487e33a9b3d89b204ede51eb438a959640a026104c5
7
- data.tar.gz: f6248284e6c30814e336c7e0e8094ce499509d82f6b01fea398ac3338ffb4552c85a132e5bb45dad264703434edba625129366ac2721701254f4be63bf6491a7
6
+ metadata.gz: 87a3b5c312e756ab0b264d42c56fc49ad1b2285ca83791d5c27982b85a82c9098f374ffeae9eab8cc60bc28119b7aab4136371cbc6dd9abbd7f79a2da3a74b0c
7
+ data.tar.gz: 9c1e0dae6f69297ee86b14dee6426efa8614d650e7636dce974944161f65168790fc2be855ed76a9578e79b04d7607a620a791de64ab4d06f396f88afc77e100
@@ -2,4 +2,15 @@ sudo: false
2
2
  language: ruby
3
3
  rvm:
4
4
  - 2.0.0
5
- script: bundle exec rspec spec
5
+ - 2.1.7
6
+ - 2.2.2
7
+ script: bundle exec rspec spec
8
+ gemfile:
9
+ - gemfiles/Gemfile.split-1.2-stable
10
+ - gemfiles/Gemfile.split-1.1-stable
11
+ - gemfiles/Gemfile.split-1.0-stable
12
+ - gemfiles/Gemfile.rails-4.2-stable
13
+ - gemfiles/Gemfile.rails-4.1-stable
14
+ - gemfiles/Gemfile.rails-4.0-stable
15
+ - gemfiles/Gemfile.rails-3.2-stable
16
+ - Gemfile
data/README.md CHANGED
@@ -16,13 +16,23 @@ Then run:
16
16
 
17
17
  bundle install
18
18
 
19
+ ### Rails 4
20
+
21
+ Because this gem uses action caching, a feature removed from Rails 4, you will also need to include the `actionpack-action_caching` gem in your Gemfile:
22
+
23
+ gem 'actionpack-action_caching'
24
+
25
+ Then run:
26
+
27
+ bundle install
28
+
19
29
  ## Why?
20
30
 
21
- We use action caching in Rails 3 to cache both our standard and mobile site. We wanted to be able to quickly run Split tests without worrying about setting a custom cache_path each time as well as remembering to make the needed changes to our ActiveRecord models.
31
+ We use action caching in Rails 3 to cache both our standard and mobile site. We wanted to be able to quickly run Split tests without worrying about setting a custom cache_path each time as well as remembering to make the needed changes to our ActiveRecord models.
22
32
 
23
- ## How?
33
+ ## How?
24
34
 
25
- Under the hood, action caching uses `fragment_cache_key` in `ActionController::Base`. This gem patches this method to incldue our generated current tests and variations.
35
+ Under the hood, action caching uses `fragment_cache_key` in `ActionController::Base`. This gem patches this method to incldue our generated current tests and variations.
26
36
 
27
37
  If you already override `fragment_cache_key` in your project you can get the split partial cache key we generate by calling `current_tests_and_variations`
28
38
 
@@ -33,12 +43,12 @@ We've created an easy to remember DSL for adding active tests to specific method
33
43
  ```
34
44
  class ProductController < ApplicationController
35
45
  cacheable_ab_test :login_flow,
36
- :only => [:index, :some_other_method],
37
- :except => [:index, :some_other_method],
46
+ :only => [:index, :some_other_method],
47
+ :except => [:index, :some_other_method],
38
48
  :if => Proc.new { |controller| controller.mobile_device? }
39
-
49
+
40
50
  def index
41
-
51
+
42
52
  end
43
53
  end
44
54
  ```
@@ -75,7 +85,7 @@ Split::Cacheable::Adapter.new(ProductController.new, :index).get_all_possible_va
75
85
  }
76
86
  ```
77
87
 
78
- Note that we don't evaluate the `:if` option when you instantiate the controller manually. This is because we assume `Proc`s will usually be used to decide whether to show the test based on the current request. By not evaluating the `:if`s in this scenario we are able to return all possible cache keys regardless of request type.
88
+ Note that we don't evaluate the `:if` option when you instantiate the controller manually. This is because we assume `Proc`s will usually be used to decide whether to show the test based on the current request. By not evaluating the `:if`s in this scenario we are able to return all possible cache keys regardless of request type.
79
89
 
80
90
  ## Development
81
91
 
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'activesupport', '~> 3.2.22'
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'activesupport', '~> 4.0.13'
6
+ gem 'actionpack-action_caching'
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'activesupport', '~> 4.1.13'
6
+ gem 'actionpack-action_caching'
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'activesupport', '~> 4.2.4'
6
+ gem 'actionpack-action_caching'
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'split', '~> 1.0.0'
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'split', '~> 1.1.0'
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'split', '~> 1.2.0'
@@ -1,6 +1,8 @@
1
1
  require "split_cacheable/version"
2
2
  require 'split_cacheable/helper'
3
- require 'split_cacheable/engine' if defined?(Rails) && Rails::VERSION::MAJOR === 3
3
+ if defined?(Rails) && [3, 4].include?(Rails::VERSION::MAJOR) && ActionController::Base.methods.include?(:caches_action)
4
+ require 'split_cacheable/engine'
5
+ end
4
6
  require 'split'
5
7
 
6
8
  # This is the main Adapter instance. It expects:
@@ -57,7 +59,9 @@ module Split
57
59
  if !defined?(@controller.request) || @controller.request.nil?
58
60
  return DEFAULT_KEY
59
61
  else
60
- return !active_tests.empty? ? active_tests.map{|test_obj| "#{test_obj[:test_name]}/#{@controller.ab_test(test_obj[:test_name])}"}.join('/') : DEFAULT_KEY
62
+ return !active_tests.empty? ? active_tests.map{ |test_obj|
63
+ "#{test_obj[:test_name]}/#{@controller.send(:ab_test, test_obj[:test_name])}"
64
+ }.join('/') : DEFAULT_KEY
61
65
  end
62
66
  end
63
67
 
@@ -72,7 +76,7 @@ module Split
72
76
  if split_test
73
77
  test_variations << split_test.alternatives.map { |alternative|
74
78
  "#{split_test.name}/#{alternative.name}"
75
- }
79
+ }
76
80
  end
77
81
  }
78
82
 
@@ -95,4 +99,4 @@ module Split
95
99
  end
96
100
  end
97
101
  end
98
- end
102
+ end
@@ -1,5 +1,5 @@
1
1
  module Split
2
2
  module Cacheable
3
- VERSION = "1.0.4"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -35,7 +35,7 @@ class TestControllerWithoutRequest
35
35
  cacheable_ab_test :test_1, :only => :index
36
36
  cacheable_ab_test :test_2, :except => :show
37
37
  def index
38
-
38
+
39
39
  end
40
40
 
41
41
  def session
@@ -58,7 +58,7 @@ class TestControllerWithRequest < TestControllerWithoutRequest
58
58
  cacheable_ab_test :test_1, :only => :index
59
59
  cacheable_ab_test :test_2, :except => :show
60
60
  def index
61
-
61
+
62
62
  end
63
63
 
64
64
  def request(ua = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; de-de) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27')
@@ -72,9 +72,9 @@ end
72
72
  class TestControllerWithRequestAndProc < TestControllerWithRequest
73
73
  cacheable_ab_test :test_1, :only => :index, :if => Proc.new { |c| c.mobile_device? }
74
74
  cacheable_ab_test :test_2, :except => :show, :if => Proc.new { |c| c.mobile_device? }
75
-
75
+
76
76
  def index
77
-
77
+
78
78
  end
79
79
 
80
80
  def mobile_device?
@@ -85,4 +85,4 @@ end
85
85
  class TestControllerWithRequestAndMultiTestOnSameAction < TestControllerWithRequest
86
86
  cacheable_ab_test :test_1, :only => :index
87
87
  cacheable_ab_test :test_2, :only => :index
88
- end
88
+ end
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Split::Cacheable::VERSION
9
9
  spec.authors = ["Daniel Schwartz"]
10
10
  spec.email = ["dschwartz88@gmail.com"]
11
- spec.summary = %q{We use action caching in Rails 3 to cache both our standard and mobile site. We wanted to be able to quickly run Split tests without worrying about setting a custom cache_path each time as well as remembering to make the needed changes to our ActiveRecord models.}
11
+ spec.summary = %q{We use action caching in Rails to cache both our standard and mobile site. We wanted to be able to quickly run Split tests without worrying about setting a custom cache_path each time as well as remembering to make the needed changes to our ActiveRecord models.}
12
12
  spec.description = %q{An extension to Split to allow for automatic cache bucket creation accross Split tests.}
13
13
  spec.homepage = "https://github.com/harrystech/split_cacheable"
14
14
  spec.license = "MIT"
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "split", "~> 1.0.0"
22
- spec.add_dependency "activesupport", ">= 3.2.17"
21
+ spec.add_dependency "split", ">= 1.0.0", "< 1.4"
22
+ spec.add_dependency "activesupport", ">= 3.2.22"
23
23
 
24
24
  spec.add_development_dependency "rspec", ">= 2.14"
25
25
  spec.add_development_dependency "pry", ">= 0"
metadata CHANGED
@@ -1,97 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: split_cacheable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schwartz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: split
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.4'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 1.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.4'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - '>='
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: 3.2.17
39
+ version: 3.2.22
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - '>='
44
+ - - ">="
39
45
  - !ruby/object:Gem::Version
40
- version: 3.2.17
46
+ version: 3.2.22
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rspec
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - '>='
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
53
  version: '2.14'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - '>='
58
+ - - ">="
53
59
  - !ruby/object:Gem::Version
54
60
  version: '2.14'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: pry
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - '>='
65
+ - - ">="
60
66
  - !ruby/object:Gem::Version
61
67
  version: '0'
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - '>='
72
+ - - ">="
67
73
  - !ruby/object:Gem::Version
68
74
  version: '0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: pry-byebug
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - '>='
79
+ - - ">="
74
80
  - !ruby/object:Gem::Version
75
81
  version: '0'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - '>='
86
+ - - ">="
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: mock_redis
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
- - - '>='
93
+ - - ">="
88
94
  - !ruby/object:Gem::Version
89
95
  version: 0.11.0
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
- - - '>='
100
+ - - ">="
95
101
  - !ruby/object:Gem::Version
96
102
  version: 0.11.0
97
103
  description: An extension to Split to allow for automatic cache bucket creation accross
@@ -102,13 +108,20 @@ executables: []
102
108
  extensions: []
103
109
  extra_rdoc_files: []
104
110
  files:
105
- - .gitignore
106
- - .travis.yml
111
+ - ".gitignore"
112
+ - ".travis.yml"
107
113
  - Gemfile
108
114
  - LICENSE
109
115
  - LICENSE.txt
110
116
  - README.md
111
117
  - Rakefile
118
+ - gemfiles/Gemfile.rails-3.2-stable
119
+ - gemfiles/Gemfile.rails-4.0-stable
120
+ - gemfiles/Gemfile.rails-4.1-stable
121
+ - gemfiles/Gemfile.rails-4.2-stable
122
+ - gemfiles/Gemfile.split-1.0-stable
123
+ - gemfiles/Gemfile.split-1.1-stable
124
+ - gemfiles/Gemfile.split-1.2-stable
112
125
  - lib/split_cacheable.rb
113
126
  - lib/split_cacheable/engine.rb
114
127
  - lib/split_cacheable/helper.rb
@@ -126,24 +139,23 @@ require_paths:
126
139
  - lib
127
140
  required_ruby_version: !ruby/object:Gem::Requirement
128
141
  requirements:
129
- - - '>='
142
+ - - ">="
130
143
  - !ruby/object:Gem::Version
131
144
  version: '0'
132
145
  required_rubygems_version: !ruby/object:Gem::Requirement
133
146
  requirements:
134
- - - '>='
147
+ - - ">="
135
148
  - !ruby/object:Gem::Version
136
149
  version: '0'
137
150
  requirements: []
138
151
  rubyforge_project:
139
- rubygems_version: 2.0.14
152
+ rubygems_version: 2.5.1
140
153
  signing_key:
141
154
  specification_version: 4
142
- summary: We use action caching in Rails 3 to cache both our standard and mobile site.
155
+ summary: We use action caching in Rails to cache both our standard and mobile site.
143
156
  We wanted to be able to quickly run Split tests without worrying about setting a
144
157
  custom cache_path each time as well as remembering to make the needed changes to
145
158
  our ActiveRecord models.
146
159
  test_files:
147
160
  - spec/cacheable_spec.rb
148
161
  - spec/spec_helper.rb
149
- has_rdoc: