kasket 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'lib/kasket'
3
4
 
4
5
  begin
5
6
  require 'jeweler'
6
7
  Jeweler::Tasks.new do |gem|
7
8
  gem.name = "kasket"
9
+ gem.version = Kasket::Version::STRING
8
10
  gem.summary = %Q{A write back caching layer on active record}
9
11
  gem.description = %Q{puts a cap on your queries}
10
12
  gem.email = "mick@staugaard.com"
data/lib/kasket.rb CHANGED
@@ -13,6 +13,13 @@ module Kasket
13
13
 
14
14
  CONFIGURATION = {:max_collection_size => 100}
15
15
 
16
+ class Version
17
+ MAJOR = 0
18
+ MINOR = 6
19
+ PATCH = 4
20
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
21
+ end
22
+
16
23
  module_function
17
24
 
18
25
  def cache
@@ -25,7 +25,7 @@ module Kasket
25
25
  end
26
26
 
27
27
  def kasket_key_prefix
28
- @kasket_key_prefix ||= "kasket/#{table_name}/version=#{column_names.join.sum}/"
28
+ @kasket_key_prefix ||= "kasket-#{Kasket::Version::STRING}/#{table_name}/version=#{column_names.join.sum}/"
29
29
  end
30
30
 
31
31
  def kasket_key_for(attribute_value_pairs)
data/test/parser_test.rb CHANGED
@@ -75,7 +75,7 @@ class ParserTest < ActiveSupport::TestCase
75
75
 
76
76
  context "key generation" do
77
77
  should "include the table name and version" do
78
- assert_match(/^kasket\/posts\/version=3558\//, @parser.parse('SELECT * FROM `posts` WHERE (id = 1)')[:key])
78
+ assert_match(/^kasket-#{Kasket::Version::STRING}\/posts\/version=3558\//, @parser.parse('SELECT * FROM `posts` WHERE (id = 1)')[:key])
79
79
  end
80
80
 
81
81
  should "include all indexed attributes" do
@@ -15,19 +15,19 @@ class ReadMixinTest < ActiveSupport::TestCase
15
15
  end
16
16
 
17
17
  should "read results" do
18
- Kasket.cache.write('kasket/posts/version=3558/id=1', @database_results.first)
18
+ Kasket.cache.write("kasket-#{Kasket::Version::STRING}/posts/version=3558/id=1", @database_results.first)
19
19
  assert_equal [ @records.first ], Post.find_by_sql('SELECT * FROM `posts` WHERE (id = 1)'), Kasket.cache.inspect
20
20
  end
21
21
 
22
22
  should "store results in kasket" do
23
23
  Post.find_by_sql('SELECT * FROM `posts` WHERE (id = 1)')
24
24
 
25
- assert_equal @database_results.first, Kasket.cache.read('kasket/posts/version=3558/id=1'), Kasket.cache.inspect
25
+ assert_equal @database_results.first, Kasket.cache.read("kasket-#{Kasket::Version::STRING}/posts/version=3558/id=1"), Kasket.cache.inspect
26
26
  end
27
27
 
28
28
  context "modifying results" do
29
29
  setup do
30
- Kasket.cache.write('kasket/posts/version=3558/id=1', @database_results.first)
30
+ Kasket.cache.write("kasket-#{Kasket::Version::STRING}/posts/version=3558/id=1", @database_results.first)
31
31
  @record = Post.find_by_sql('SELECT * FROM `posts` WHERE (id = 1)').first
32
32
  @record.instance_variable_get(:@attributes)['id'] = 3
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kasket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mick Staugaard
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-12-08 00:00:00 -08:00
13
+ date: 2009-12-09 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -68,7 +68,6 @@ files:
68
68
  - LICENSE
69
69
  - README.rdoc
70
70
  - Rakefile
71
- - VERSION
72
71
  - lib/kasket.rb
73
72
  - lib/kasket/active_record_patches.rb
74
73
  - lib/kasket/cache.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.6.3