arid_cache 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -12,7 +12,7 @@ gem 'ruby-debug', '=0.10.3'
12
12
  gem 'ruby-debug-base', '=0.10.3'
13
13
  gem 'machinist', '=1.0.6'
14
14
  gem 'faker', '=0.3.1'
15
- gem 'rspec', '=1.3.0', :require => 'spec'
15
+ gem 'rspec', '~>1.3.1', :require => 'spec'
16
16
  gem 'test-unit', '=1.2.3'
17
17
  gem 'mocha', '=0.9.8'
18
18
  gem 'arid_cache', :path => "./"
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rubygems'
2
+ require 'thread'
2
3
  require 'bundler/setup'
3
4
  Bundler.require
4
5
 
@@ -38,8 +39,6 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
38
39
  spec.rcov = true
39
40
  end
40
41
 
41
- task :spec => :check_dependencies
42
-
43
42
  require 'rake/testtask'
44
43
  Rake::TestTask.new(:test) do |test|
45
44
  test.libs << 'lib' << 'test'
@@ -47,7 +46,6 @@ Rake::TestTask.new(:test) do |test|
47
46
  test.verbose = true
48
47
  end
49
48
 
50
- task :test => :check_dependencies
51
49
  task :default => :test
52
50
 
53
51
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.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.1.0"
8
+ s.version = "1.1.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-12-17}
12
+ s.date = %q{2011-03-21}
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
  }
@@ -33,6 +33,7 @@ AridCache is designed for handling large, expensive ActiveRecord collections but
33
33
  "lib/arid_cache/helpers.rb",
34
34
  "lib/arid_cache/store.rb",
35
35
  "rails/init.rb",
36
+ "spec/arid_cache/active_record_spec.rb",
36
37
  "spec/arid_cache/arid_cache_spec.rb",
37
38
  "spec/arid_cache/cache_proxy_result_spec.rb",
38
39
  "spec/arid_cache/cache_proxy_spec.rb",
@@ -57,10 +58,11 @@ AridCache is designed for handling large, expensive ActiveRecord collections but
57
58
  s.homepage = %q{http://github.com/kjvarga/arid_cache}
58
59
  s.rdoc_options = ["--charset=UTF-8"]
59
60
  s.require_paths = ["lib"]
60
- s.rubygems_version = %q{1.3.7}
61
+ s.rubygems_version = %q{1.6.2}
61
62
  s.summary = %q{Automates efficient caching of your ActiveRecord collections, gives you counts for free and supports pagination.}
62
63
  s.test_files = [
63
- "spec/arid_cache/arid_cache_spec.rb",
64
+ "spec/arid_cache/active_record_spec.rb",
65
+ "spec/arid_cache/arid_cache_spec.rb",
64
66
  "spec/arid_cache/cache_proxy_result_spec.rb",
65
67
  "spec/arid_cache/cache_proxy_spec.rb",
66
68
  "spec/spec_helper.rb",
@@ -80,7 +82,6 @@ AridCache is designed for handling large, expensive ActiveRecord collections but
80
82
  ]
81
83
 
82
84
  if s.respond_to? :specification_version then
83
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
84
85
  s.specification_version = 3
85
86
 
86
87
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -4,14 +4,6 @@ module AridCache
4
4
  base.extend ClassMethods
5
5
  base.extend MirrorMethods
6
6
  base.send :include, MirrorMethods
7
- base.class_eval do
8
- alias_method_chain :method_missing, :arid_cache
9
- alias_method_chain :respond_to?, :arid_cache
10
- end
11
- class << base
12
- alias_method_chain :method_missing, :arid_cache
13
- alias_method_chain :respond_to?, :arid_cache
14
- end
15
7
  end
16
8
 
17
9
  module MirrorMethods
@@ -49,26 +41,26 @@ module AridCache
49
41
  'arid-cache-' + object_key + '-' + key.to_s
50
42
  end
51
43
 
52
- def respond_to_with_arid_cache?(method, include_private = false) #:nodoc:
44
+ def respond_to?(method, include_private = false) #:nodoc:
53
45
  if (method.to_s =~ /^cached_.*(_count)?$/).nil?
54
- respond_to_without_arid_cache?(method, include_private)
46
+ super(method, include_private)
55
47
  elsif method.to_s =~ /^cached_(.*)_count$/
56
48
  AridCache.store.has?(self, "#{$1}_count") || AridCache.store.has?(self, $1) || super("#{$1}_count", include_private) || super($1, include_private)
57
49
  elsif method.to_s =~ /^cached_(.*)$/
58
50
  AridCache.store.has?(self, $1) || super($1, include_private)
59
51
  else
60
- respond_to_without_arid_cache?(method, include_private)
52
+ super
61
53
  end
62
54
  end
63
55
 
64
56
  protected
65
57
 
66
- def method_missing_with_arid_cache(method, *args, &block) #:nodoc:
58
+ def method_missing(method, *args, &block) #:nodoc:
67
59
  if method.to_s =~ /^cached_(.*)$/
68
60
  opts = args.empty? ? {} : args.first
69
61
  AridCache.lookup(self, $1, opts, &block)
70
62
  else
71
- method_missing_without_arid_cache(method, *args)
63
+ super
72
64
  end
73
65
  end
74
66
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe AridCache::ActiveRecord do
4
+ context 'respond_to?' do
5
+ before :each do
6
+ @class = Class.new(Class.new)
7
+ @class.send(:include, AridCache)
8
+ end
9
+
10
+ it "should not fail if a superclass doesn't include AridCache" do
11
+ lambda {
12
+ @class.respond_to?(:cached_xxx).should be_false
13
+ }.should_not raise_error(NoMethodError)
14
+ end
15
+ end
16
+ end
data/test/test_helper.rb CHANGED
@@ -2,6 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib')) # make requiring fr
2
2
 
3
3
  require 'fileutils'
4
4
  require 'rubygems'
5
+ require 'thread'
5
6
  require 'bundler/setup'
6
7
  Bundler.require
7
8
  require 'test/unit' # required by ActiveSupport::TestCase
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arid_cache
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
4
+ hash: 17
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 0
10
- version: 1.1.0
9
+ - 1
10
+ version: 1.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Karl Varga
@@ -15,14 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-17 00:00:00 -08:00
18
+ date: 2011-03-21 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
22
  type: :runtime
24
- name: will_paginate
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
26
24
  none: false
27
25
  requirements:
28
26
  - - ">="
@@ -31,12 +29,12 @@ dependencies:
31
29
  segments:
32
30
  - 0
33
31
  version: "0"
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
32
+ name: will_paginate
33
+ version_requirements: *id001
36
34
  prerelease: false
35
+ - !ruby/object:Gem::Dependency
37
36
  type: :development
38
- name: will_paginate
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ requirement: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
42
40
  - - ">="
@@ -45,12 +43,12 @@ dependencies:
45
43
  segments:
46
44
  - 0
47
45
  version: "0"
48
- requirement: *id002
49
- - !ruby/object:Gem::Dependency
46
+ name: will_paginate
47
+ version_requirements: *id002
50
48
  prerelease: false
49
+ - !ruby/object:Gem::Dependency
51
50
  type: :development
52
- name: faker
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
51
+ requirement: &id003 !ruby/object:Gem::Requirement
54
52
  none: false
55
53
  requirements:
56
54
  - - ">="
@@ -59,12 +57,12 @@ dependencies:
59
57
  segments:
60
58
  - 0
61
59
  version: "0"
62
- requirement: *id003
63
- - !ruby/object:Gem::Dependency
60
+ name: faker
61
+ version_requirements: *id003
64
62
  prerelease: false
63
+ - !ruby/object:Gem::Dependency
65
64
  type: :development
66
- name: machinist
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
65
+ requirement: &id004 !ruby/object:Gem::Requirement
68
66
  none: false
69
67
  requirements:
70
68
  - - ">="
@@ -73,7 +71,9 @@ dependencies:
73
71
  segments:
74
72
  - 0
75
73
  version: "0"
76
- requirement: *id004
74
+ name: machinist
75
+ version_requirements: *id004
76
+ prerelease: false
77
77
  description: |
78
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.
79
79
  AridCache is designed for handling large, expensive ActiveRecord collections but is equally useful for caching anything else as well.
@@ -101,6 +101,7 @@ files:
101
101
  - lib/arid_cache/helpers.rb
102
102
  - lib/arid_cache/store.rb
103
103
  - rails/init.rb
104
+ - spec/arid_cache/active_record_spec.rb
104
105
  - spec/arid_cache/arid_cache_spec.rb
105
106
  - spec/arid_cache/cache_proxy_result_spec.rb
106
107
  - spec/arid_cache/cache_proxy_spec.rb
@@ -151,11 +152,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  requirements: []
152
153
 
153
154
  rubyforge_project:
154
- rubygems_version: 1.3.7
155
+ rubygems_version: 1.6.2
155
156
  signing_key:
156
157
  specification_version: 3
157
158
  summary: Automates efficient caching of your ActiveRecord collections, gives you counts for free and supports pagination.
158
159
  test_files:
160
+ - spec/arid_cache/active_record_spec.rb
159
161
  - spec/arid_cache/arid_cache_spec.rb
160
162
  - spec/arid_cache/cache_proxy_result_spec.rb
161
163
  - spec/arid_cache/cache_proxy_spec.rb