arid_cache 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -6
- data/VERSION +1 -1
- data/arid_cache.gemspec +4 -4
- data/lib/arid_cache/active_record.rb +16 -16
- data/test/arid_cache_test.rb +13 -0
- data/test/console +0 -0
- metadata +49 -21
data/Rakefile
CHANGED
@@ -59,10 +59,17 @@ Rake::RDocTask.new do |rdoc|
|
|
59
59
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
60
60
|
end
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
namespace :release do
|
63
|
+
desc "Release a new patch version"
|
64
|
+
task :patch do
|
65
|
+
Rake::Task['version:bump:patch'].invoke
|
66
|
+
Rake::Task['release:current'].invoke
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "Release the current version (after a manual version bump). This rebuilds the gemspec, pushes the updated code, tags it and releases to RubyGems"
|
70
|
+
task :current do
|
71
|
+
Rake::Task['github:release'].invoke
|
72
|
+
Rake::Task['git:release'].invoke
|
73
|
+
Rake::Task['gemcutter:release'].invoke
|
74
|
+
end
|
68
75
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/arid_cache.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{arid_cache}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Karl Varga"]
|
12
|
-
s.date = %q{2010-07
|
12
|
+
s.date = %q{2010-09-07}
|
13
13
|
s.description = %q{AridCache makes caching easy and effective. AridCache supports caching on all your model named scopes, class methods and instance methods right out of the box. AridCache prevents caching logic from cluttering your models and clarifies your logic by making explicit calls to cached result sets.
|
14
14
|
AridCache is designed for handling large, expensive ActiveRecord collections but is equally useful for caching anything else as well.
|
15
15
|
}
|
@@ -51,7 +51,7 @@ AridCache is designed for handling large, expensive ActiveRecord collections but
|
|
51
51
|
s.homepage = %q{http://github.com/kjvarga/arid_cache}
|
52
52
|
s.rdoc_options = ["--charset=UTF-8"]
|
53
53
|
s.require_paths = ["lib"]
|
54
|
-
s.rubygems_version = %q{1.3.
|
54
|
+
s.rubygems_version = %q{1.3.7}
|
55
55
|
s.summary = %q{Automates efficient caching of your ActiveRecord collections, gives you counts for free and supports pagination.}
|
56
56
|
s.test_files = [
|
57
57
|
"spec/arid_cache_spec.rb",
|
@@ -71,7 +71,7 @@ AridCache is designed for handling large, expensive ActiveRecord collections but
|
|
71
71
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
72
72
|
s.specification_version = 3
|
73
73
|
|
74
|
-
if Gem::Version.new(Gem::
|
74
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
75
75
|
s.add_runtime_dependency(%q<will_paginate>, [">= 0"])
|
76
76
|
s.add_development_dependency(%q<will_paginate>, [">= 0"])
|
77
77
|
s.add_development_dependency(%q<faker>, [">= 0"])
|
@@ -1,19 +1,19 @@
|
|
1
1
|
module AridCache
|
2
|
-
module ActiveRecord
|
2
|
+
module ActiveRecord
|
3
3
|
def self.included(base)
|
4
4
|
base.extend ClassMethods
|
5
5
|
base.extend MirrorMethods
|
6
6
|
base.send :include, MirrorMethods
|
7
7
|
base.class_eval do
|
8
|
-
alias_method_chain :method_missing, :arid_cache
|
9
|
-
alias_method_chain :respond_to?, :arid_cache
|
8
|
+
alias_method_chain :method_missing, :arid_cache
|
9
|
+
alias_method_chain :respond_to?, :arid_cache
|
10
10
|
end
|
11
11
|
class << base
|
12
|
-
alias_method_chain :method_missing, :arid_cache
|
13
|
-
alias_method_chain :respond_to?, :arid_cache
|
12
|
+
alias_method_chain :method_missing, :arid_cache
|
13
|
+
alias_method_chain :respond_to?, :arid_cache
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
module MirrorMethods
|
18
18
|
def clear_caches
|
19
19
|
AridCache.cache.clear_class_caches(self)
|
@@ -27,7 +27,7 @@ module AridCache
|
|
27
27
|
def clear_instance_caches
|
28
28
|
AridCache.cache.clear_instance_caches(self)
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
# Return an AridCache key for the given key fragment for this object.
|
32
32
|
#
|
33
33
|
# Supported options:
|
@@ -60,7 +60,7 @@ module AridCache
|
|
60
60
|
respond_to_without_arid_cache?(method, include_private)
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
protected
|
65
65
|
|
66
66
|
def method_missing_with_arid_cache(method, *args, &block) #:nodoc:
|
@@ -72,24 +72,24 @@ module AridCache
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
module ClassMethods
|
77
|
-
|
77
|
+
|
78
78
|
def instance_caches(opts={}, &block)
|
79
79
|
AridCache::Store::InstanceCacheConfiguration.new(self, opts).instance_eval(&block) && nil
|
80
80
|
end
|
81
81
|
|
82
82
|
def class_caches(opts={}, &block)
|
83
|
-
AridCache::Store::ClassCacheConfiguration.new(self, opts).instance_eval(&block) && nil
|
84
|
-
end
|
83
|
+
AridCache::Store::ClassCacheConfiguration.new(self, opts).instance_eval(&block) && nil
|
84
|
+
end
|
85
85
|
|
86
86
|
def is_mysql_adapter?
|
87
|
-
@is_mysql_adapter ||= ::ActiveRecord::Base.connection.adapter_name =~ /MySQL/
|
88
|
-
end
|
89
|
-
|
87
|
+
@is_mysql_adapter ||= ::ActiveRecord::Base.connection.adapter_name =~ /MySQL/i
|
88
|
+
end
|
89
|
+
|
90
90
|
def is_mysql_adapter=(value)
|
91
91
|
@is_mysql_adapter = value
|
92
|
-
end
|
92
|
+
end
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
data/test/arid_cache_test.rb
CHANGED
@@ -366,6 +366,19 @@ class AridCacheTest < ActiveSupport::TestCase
|
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
369
|
+
test "should identify the MySQL2 adapter as a MySQL database" do
|
370
|
+
original_adapter_name = ::ActiveRecord::Base.connection.adapter_name
|
371
|
+
::ActiveRecord::Base.connection.instance_eval { def adapter_name; "Mysql2"; end }
|
372
|
+
assert_equal ::ActiveRecord::Base.connection.adapter_name, "Mysql2"
|
373
|
+
assert ::ActiveRecord::Base.is_mysql_adapter?
|
374
|
+
|
375
|
+
# Restore it otherwise the other tests break
|
376
|
+
::ActiveRecord::Base.connection.instance_eval { def adapter_name; "SQLite3"; end }
|
377
|
+
assert_equal ::ActiveRecord::Base.connection.adapter_name, "SQLite3"
|
378
|
+
::ActiveRecord::Base.is_mysql_adapter = nil
|
379
|
+
assert !::ActiveRecord::Base.is_mysql_adapter?
|
380
|
+
end
|
381
|
+
|
369
382
|
#
|
370
383
|
# Tests requiring manual verification by looking at the SQL logs.
|
371
384
|
# TODO move these to a separate class.
|
data/test/console
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arid_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 21
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Karl Varga
|
@@ -9,49 +15,65 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-07
|
18
|
+
date: 2010-09-07 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: will_paginate
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
23
32
|
version: "0"
|
24
|
-
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: will_paginate
|
27
|
-
|
28
|
-
|
29
|
-
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
30
40
|
requirements:
|
31
41
|
- - ">="
|
32
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
33
46
|
version: "0"
|
34
|
-
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
35
49
|
- !ruby/object:Gem::Dependency
|
36
50
|
name: faker
|
37
|
-
|
38
|
-
|
39
|
-
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
40
54
|
requirements:
|
41
55
|
- - ">="
|
42
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
43
60
|
version: "0"
|
44
|
-
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
45
63
|
- !ruby/object:Gem::Dependency
|
46
64
|
name: machinist
|
47
|
-
|
48
|
-
|
49
|
-
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
50
68
|
requirements:
|
51
69
|
- - ">="
|
52
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
53
74
|
version: "0"
|
54
|
-
|
75
|
+
type: :development
|
76
|
+
version_requirements: *id004
|
55
77
|
description: |
|
56
78
|
AridCache makes caching easy and effective. AridCache supports caching on all your model named scopes, class methods and instance methods right out of the box. AridCache prevents caching logic from cluttering your models and clarifies your logic by making explicit calls to cached result sets.
|
57
79
|
AridCache is designed for handling large, expensive ActiveRecord collections but is equally useful for caching anything else as well.
|
@@ -103,21 +125,27 @@ rdoc_options:
|
|
103
125
|
require_paths:
|
104
126
|
- lib
|
105
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
106
129
|
requirements:
|
107
130
|
- - ">="
|
108
131
|
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
109
135
|
version: "0"
|
110
|
-
version:
|
111
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
112
138
|
requirements:
|
113
139
|
- - ">="
|
114
140
|
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
115
144
|
version: "0"
|
116
|
-
version:
|
117
145
|
requirements: []
|
118
146
|
|
119
147
|
rubyforge_project:
|
120
|
-
rubygems_version: 1.3.
|
148
|
+
rubygems_version: 1.3.7
|
121
149
|
signing_key:
|
122
150
|
specification_version: 3
|
123
151
|
summary: Automates efficient caching of your ActiveRecord collections, gives you counts for free and supports pagination.
|