horcrux 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  A Horcrux is a powerful object in which a Dark wizard or witch has hidden a
4
4
  fragment of his or her soul for the purpose of attaining immortality.
5
5
 
6
- The Horcrux ruby gem is an abstract key/value store adapter library.
6
+ The Horcrux ruby gem is an abstract key/value store adapter library. This is
7
+ currently used at GitHub to load the activity feed from memcache or MySQL.
7
8
 
8
9
  Horcrux adapters are shims around key/value systems. They need to define at
9
10
  least these three methods:
@@ -45,11 +46,11 @@ directly. Here's what a custom MessagePack serializer might look like:
45
46
 
46
47
  ```ruby
47
48
  module MessagePackSerializer
48
- def self.pack(value)
49
+ def self.dump(value)
49
50
  value.to_msgpack
50
51
  end
51
52
 
52
- def self.unpack(str)
53
+ def self.load(str)
53
54
  MessagePack.unpack(str)
54
55
  end
55
56
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  ## If your rubyforge_project name is different, then edit it and comment out
13
13
  ## the sub! line in the Rakefile
14
14
  s.name = 'horcrux'
15
- s.version = '0.1.0'
16
- s.date = '2012-01-09'
15
+ s.version = '0.1.1'
16
+ s.date = '2012-08-09'
17
17
  s.rubyforge_project = 'horcrux'
18
18
 
19
19
  ## Make sure your summary is short. The description may be as long
@@ -1,6 +1,6 @@
1
1
  # See the README.md
2
2
  module Horcrux
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
 
5
5
  # Implements the optional methods of a Horcrux adapter.
6
6
  module Methods
@@ -9,6 +9,7 @@ module Horcrux
9
9
  end
10
10
 
11
11
  def load(str)
12
+ str.force_encoding('BINARY') if str.respond_to?(:force_encoding)
12
13
  MessagePack.unpack(str)
13
14
  end
14
15
  end
@@ -95,6 +95,19 @@ module Horcrux
95
95
  assert_equal 2, called
96
96
  end
97
97
 
98
+ def test_skips_missing_callback_on_perfect_get_all
99
+ called = 0
100
+
101
+ @adapter.on_missing do |adapter, values|
102
+ called += 1
103
+ end
104
+
105
+ @cache1.set_all 'a' => '1', 'b' => '2', 'c' => '3'
106
+
107
+ assert_equal %w(1 2 3), @adapter.get_all('a', 'b', 'c')
108
+ assert_equal 0, called
109
+ end
110
+
98
111
  def test_ignores_errors
99
112
  called = false
100
113
 
metadata CHANGED
@@ -1,59 +1,54 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: horcrux
3
- version: !ruby/object:Gem::Version
4
- hash: 27
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Rick Olson
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-09 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-08-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: test-unit
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: test-unit
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
46
38
  type: :development
47
- version_requirements: *id002
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
48
46
  description: Simple key/value adapter library.
49
47
  email: technoweenie@gmail.com
50
48
  executables: []
51
-
52
49
  extensions: []
53
-
54
50
  extra_rdoc_files: []
55
-
56
- files:
51
+ files:
57
52
  - Gemfile
58
53
  - LICENSE.md
59
54
  - README.md
@@ -71,40 +66,29 @@ files:
71
66
  - test/serializer_test.rb
72
67
  homepage: http://github.com/technoweenie/horcrux
73
68
  licenses: []
74
-
75
69
  post_install_message:
76
70
  rdoc_options: []
77
-
78
- require_paths:
71
+ require_paths:
79
72
  - lib
80
- required_ruby_version: !ruby/object:Gem::Requirement
73
+ required_ruby_version: !ruby/object:Gem::Requirement
81
74
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
89
- required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
80
  none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- hash: 17
95
- segments:
96
- - 1
97
- - 3
98
- - 5
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
99
84
  version: 1.3.5
100
85
  requirements: []
101
-
102
86
  rubyforge_project: horcrux
103
- rubygems_version: 1.8.10
87
+ rubygems_version: 1.8.23
104
88
  signing_key:
105
89
  specification_version: 2
106
90
  summary: Simple key/value adapter library.
107
- test_files:
91
+ test_files:
108
92
  - test/entity_test.rb
109
93
  - test/helper.rb
110
94
  - test/memory_test.rb