mack-caching 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/bin/cachetastic_drb_server +0 -0
  2. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic.rb +3 -0
  3. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/adapters/base.rb +1 -3
  4. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/adapters/drb.rb +0 -0
  5. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/adapters/file.rb +0 -0
  6. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/adapters/file_base.rb +0 -0
  7. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/adapters/html_file.rb +0 -0
  8. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/adapters/local_memory.rb +0 -0
  9. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/adapters/memcache.rb +2 -2
  10. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/adapters/store_object.rb +0 -0
  11. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/cacheable.rb +5 -3
  12. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/caches/base.rb +0 -0
  13. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/caches/mack_session_cache.rb +0 -0
  14. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/caches/page_cache.rb +0 -0
  15. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/caches/rails_session_cache.rb +0 -0
  16. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/connection.rb +0 -0
  17. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/errors/unsupported_adapter.rb +0 -0
  18. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/logger.rb +0 -0
  19. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/rails_extensions/active_record_base.rb +0 -0
  20. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/rails_extensions/cgi_session_store.rb +0 -0
  21. data/lib/gems/cachetastic-2.1.2/lib/cachetastic/ruby_extensions/kernel.rb +25 -0
  22. data/lib/gems/{cachetastic-2.0.0 → cachetastic-2.1.2}/lib/cachetastic/ruby_extensions/object.rb +0 -0
  23. data/lib/gems/cachetastic-2.1.2/lib/tasks/cachetastic_tasks.rake +116 -0
  24. data/lib/gems/cachetastic-2.1.2/lib/tasks/rubyforge_config.yml +5 -0
  25. metadata +39 -32
@@ -7,6 +7,7 @@ require 'zlib'
7
7
  require 'pp'
8
8
  require 'drb'
9
9
  require 'configatron'
10
+ # require 'mack-facets'
10
11
  begin
11
12
  require 'memcache'
12
13
  rescue Exception => e
@@ -60,6 +61,8 @@ require File.join(home, 'adapters/drb')
60
61
  require File.join(home, 'cacheable')
61
62
  require File.join(home, 'rails_extensions/active_record_base')
62
63
  require File.join(home, 'rails_extensions/cgi_session_store')
64
+ require File.join(home, 'ruby_extensions/object')
65
+ require File.join(home, 'ruby_extensions/kernel')
63
66
 
64
67
  configatron.cachetastic_default_options.set_default(:debug, false)
65
68
  configatron.cachetastic_default_options.set_default(:adapter, :local_memory)
@@ -41,9 +41,7 @@ class Cachetastic::Adapters::Base
41
41
  # Returns true/or falsed based on whether or not the debug setting is set to true in the
42
42
  # configuration file. If the config setting is set, then false is returned.
43
43
  def debug?
44
- ivar_cache(:debug) do
45
- configuration.retrieve(:debug, false)
46
- end
44
+ configuration.retrieve(:debug, false)
47
45
  end
48
46
 
49
47
  def stats
@@ -20,7 +20,7 @@
20
20
  class Cachetastic::Adapters::Memcache < Cachetastic::Adapters::Base
21
21
 
22
22
  def setup
23
- self.conn = MemCache.new(configuration.servers, configuration.store_options.to_hash.merge({:namespace => self.namespace}))
23
+ self.conn = MemCache.new([configuration.servers].flatten, configuration.store_options.to_hash.merge({:namespace => self.namespace}))
24
24
  self.version = self.get_version(self.name)
25
25
  end
26
26
 
@@ -91,7 +91,7 @@ class Cachetastic::Adapters::Memcache < Cachetastic::Adapters::Base
91
91
 
92
92
  def ns_versions
93
93
  ivar_cache do
94
- ns_conn = MemCache.new(configuration.servers, configuration.store_options.to_hash.merge({:namespace => :namespace_versions}))
94
+ ns_conn = MemCache.new([configuration.servers].flatten, configuration.store_options.to_hash.merge({:namespace => :namespace_versions}))
95
95
  end
96
96
  end
97
97
 
@@ -41,14 +41,16 @@ module Cachetastic
41
41
  n = self.name if n == "Class"
42
42
  # puts "n: #{n}"
43
43
  c_name = "Cachetastic::Cacheable::#{n}Cache"
44
- unless Cachetastic::Cacheable.const_defined?("#{n}Cache")
45
- # puts "we need to create a cache for: #{c_name}"
44
+ begin
45
+ return c_name.constantize
46
+ rescue NameError => e
46
47
  eval %{
47
48
  class #{c_name} < Cachetastic::Caches::Base
48
49
  end
49
50
  }
51
+ return c_name.constantize
50
52
  end
51
- c_name.constantize
53
+
52
54
  end
53
55
 
54
56
  # How much did I want to call this method cache?? It originally was that, but
@@ -0,0 +1,25 @@
1
+ module Kernel # :nodoc:
2
+
3
+ def retryable(options = {}, &block) # :nodoc:
4
+ opts = { :tries => 1, :on => Exception }.merge(options)
5
+
6
+ retries = opts[:tries]
7
+ retry_exceptions = [opts[:on]].flatten
8
+
9
+ x = %{
10
+ begin
11
+ return yield
12
+ rescue #{retry_exceptions.join(", ")} => e
13
+ retries -= 1
14
+ if retries > 0
15
+ retry
16
+ else
17
+ raise e
18
+ end
19
+ end
20
+ }
21
+
22
+ eval(x, &block)
23
+ end
24
+
25
+ end
@@ -0,0 +1,116 @@
1
+ require 'rake'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'find'
6
+ require 'fileutils'
7
+ require 'rubyforge'
8
+ require 'ruby_forge_config'
9
+ namespace :rgem do
10
+
11
+ namespace :rdoc do
12
+
13
+ desc "Rdoc the cachetastic gem."
14
+ task :cachetastic do |t|
15
+ rfc = RubyForgeConfig.load(__FILE__)
16
+ pwd = FileUtils.pwd
17
+ FileUtils.cd "#{RAILS_ROOT}/vendor/plugins/#{rfc.gem_name}"
18
+ FileUtils.rm_rf 'doc', :verbose => true
19
+ puts `rdoc --title Cachetastic --main lib/cachetastic.rb`
20
+ FileUtils.cp "README", "doc/README"
21
+ FileUtils.cd pwd
22
+ end
23
+
24
+ end
25
+
26
+ namespace :package do
27
+
28
+ desc "Package up the cachetastic gem."
29
+ task :cachetastic do |t|
30
+ rfc = RubyForgeConfig.load(__FILE__)
31
+ pwd = FileUtils.pwd
32
+ FileUtils.cd "#{RAILS_ROOT}/vendor/plugins/#{rfc.gem_name}"
33
+ gem_spec = Gem::Specification.new do |s|
34
+ s.name = rfc.gem_name
35
+ s.version = rfc.version
36
+ s.summary = rfc.gem_name
37
+ s.description = %{#{rfc.gem_name} was developed by: markbates}
38
+ s.author = "markbates"
39
+ s.has_rdoc = true
40
+ s.extra_rdoc_files = ["README"]
41
+ s.files = FileList["README", "**/*.*"].exclude("pkg").exclude("#{rfc.gem_name}_tasks.rake").exclude("init.rb").exclude("doc")
42
+ s.require_paths << 'lib'# << 'doc'
43
+
44
+ s.bindir = "bin"
45
+ s.executables << "cachetastic_drb_server"
46
+
47
+ s.rdoc_options << '--title' << 'Cachetastic-RDoc' << '--main' << 'README' << '--line-numbers' << "--inline-source"
48
+
49
+ # This will loop through all files in your lib directory and autorequire them for you.
50
+ # It will also ignore all Subversion files.
51
+ s.autorequire = []
52
+
53
+ s.autorequire = ['cachetastic']
54
+
55
+ # ["lib"].each do |dir|
56
+ # Find.find(dir) do |f|
57
+ # if FileTest.directory?(f) and !f.match(/.svn/)
58
+ # s.require_paths << f
59
+ # else
60
+ # if FileTest.file?(f)
61
+ # m = f.match(/\/[a-zA-Z-_]*.rb/)
62
+ # if m
63
+ # model = m.to_s
64
+ # unless model.match("test_")
65
+ # #puts "model = #{model}"
66
+ # x = model.gsub('/', '').gsub('.rb', '')
67
+ # s.autorequire << x
68
+ # end
69
+ # #puts x
70
+ # end
71
+ # end
72
+ # end
73
+ # end
74
+ # end
75
+
76
+ s.rubyforge_project = rfc.project
77
+ end
78
+ Rake::GemPackageTask.new(gem_spec) do |pkg|
79
+ pkg.package_dir = "#{RAILS_ROOT}/pkg"
80
+ pkg.need_zip = false
81
+ pkg.need_tar = false
82
+ end
83
+ Rake::Task["package"].invoke
84
+ FileUtils.cd pwd
85
+ end
86
+
87
+ end
88
+
89
+ namespace :install do
90
+
91
+ desc "Package up and install the cachetastic gem."
92
+ task :cachetastic => "rgem:package:cachetastic" do |t|
93
+ rfc = RubyForgeConfig.load(__FILE__)
94
+ rfc.install("#{RAILS_ROOT}/pkg")
95
+ end
96
+
97
+ end
98
+
99
+ namespace :release do
100
+
101
+ desc "Package up, install, and release the cachetastic gem."
102
+ task :cachetastic => ["rgem:install:cachetastic"] do |t|
103
+ rfc = RubyForgeConfig.load(__FILE__)
104
+ rfc.release
105
+ end
106
+
107
+ end
108
+
109
+ end
110
+
111
+ desc "Test Cachetastic"
112
+ Rake::TestTask.new(:cache => "test:setup") do |t|
113
+ t.libs << "test"
114
+ t.pattern = 'test/**/cachetastic/*_test.rb'
115
+ t.verbose = true
116
+ end
@@ -0,0 +1,5 @@
1
+ --- !ruby/object:RubyForgeConfig
2
+ gem_name: cachetastic
3
+ package: cachetastic
4
+ project: magrathea
5
+ version: 1.4.2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mack-caching
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-30 00:00:00 -05:00
12
+ date: 2009-01-18 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,36 +24,43 @@ extra_rdoc_files:
24
24
  files:
25
25
  - lib/gems
26
26
  - lib/gems/cache
27
- - lib/gems/cachetastic-2.0.0
28
- - lib/gems/cachetastic-2.0.0/bin
29
- - lib/gems/cachetastic-2.0.0/bin/cachetastic_drb_server
30
- - lib/gems/cachetastic-2.0.0/lib
31
- - lib/gems/cachetastic-2.0.0/lib/cachetastic
32
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters
33
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters/base.rb
34
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters/drb.rb
35
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters/file.rb
36
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters/file_base.rb
37
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters/html_file.rb
38
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters/local_memory.rb
39
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters/memcache.rb
40
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/adapters/store_object.rb
41
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/cacheable.rb
42
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/caches
43
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/caches/base.rb
44
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/caches/mack_session_cache.rb
45
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/caches/page_cache.rb
46
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/caches/rails_session_cache.rb
47
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/connection.rb
48
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/errors
49
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/errors/unsupported_adapter.rb
50
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/logger.rb
51
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/rails_extensions
52
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/rails_extensions/active_record_base.rb
53
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/rails_extensions/cgi_session_store.rb
54
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/ruby_extensions
55
- - lib/gems/cachetastic-2.0.0/lib/cachetastic/ruby_extensions/object.rb
56
- - lib/gems/cachetastic-2.0.0/lib/cachetastic.rb
27
+ - lib/gems/cachetastic-2.1.0
28
+ - lib/gems/cachetastic-2.1.0/lib
29
+ - lib/gems/cachetastic-2.1.0/lib/cachetastic
30
+ - lib/gems/cachetastic-2.1.2
31
+ - lib/gems/cachetastic-2.1.2/bin
32
+ - lib/gems/cachetastic-2.1.2/bin/cachetastic_drb_server
33
+ - lib/gems/cachetastic-2.1.2/lib
34
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic
35
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters
36
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters/base.rb
37
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters/drb.rb
38
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters/file.rb
39
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters/file_base.rb
40
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters/html_file.rb
41
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters/local_memory.rb
42
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters/memcache.rb
43
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/adapters/store_object.rb
44
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/cacheable.rb
45
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/caches
46
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/caches/base.rb
47
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/caches/mack_session_cache.rb
48
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/caches/page_cache.rb
49
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/caches/rails_session_cache.rb
50
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/connection.rb
51
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/errors
52
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/errors/unsupported_adapter.rb
53
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/logger.rb
54
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/rails_extensions
55
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/rails_extensions/active_record_base.rb
56
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/rails_extensions/cgi_session_store.rb
57
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/ruby_extensions
58
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/ruby_extensions/kernel.rb
59
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic/ruby_extensions/object.rb
60
+ - lib/gems/cachetastic-2.1.2/lib/cachetastic.rb
61
+ - lib/gems/cachetastic-2.1.2/lib/tasks
62
+ - lib/gems/cachetastic-2.1.2/lib/tasks/cachetastic_tasks.rake
63
+ - lib/gems/cachetastic-2.1.2/lib/tasks/rubyforge_config.yml
57
64
  - lib/gems/doc
58
65
  - lib/gems/gems
59
66
  - lib/gems/memcache-client-1.5.0