kvom 6.8.0.539.93842523 → 6.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/kvom.gemspec +1 -1
- data/lib/kvom/adapter/attributes.rb +5 -4
- data/lib/kvom/adapter/filesystem_adapter.rb +2 -1
- data/lib/kvom/adapter/filesystem_document.rb +2 -1
- data/lib/kvom/lib/json_value.rb +3 -2
- data/lib/kvom/storage/base.rb +2 -2
- data/lib/kvom/storage/s3_storage.rb +1 -1
- metadata +116 -124
- data/lib/kvom/lib/json.rb +0 -14
- data/spec/lib/json_spec.rb +0 -30
data/kvom.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
23
|
|
24
|
-
s.add_runtime_dependency "multi_json", "~> 1"
|
24
|
+
s.add_runtime_dependency "multi_json", "~> 1.3"
|
25
25
|
s.add_runtime_dependency "activesupport", ">= 3" # does not support rational versioning, does it?
|
26
26
|
s.add_runtime_dependency "activemodel", ">= 3" # adapters
|
27
27
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'kvom/adapter'
|
2
|
+
require 'multi_json'
|
2
3
|
|
3
4
|
module Kvom; module Adapter
|
4
5
|
|
@@ -6,7 +7,7 @@ class Attributes
|
|
6
7
|
def initialize(attributes, from_db = false)
|
7
8
|
if from_db
|
8
9
|
meta = attributes && attributes.delete("@meta.json")
|
9
|
-
@coding = meta &&
|
10
|
+
@coding = meta && MultiJson.load(meta)["coding"] || {}
|
10
11
|
@coded_attributes = attributes
|
11
12
|
@attributes = {}
|
12
13
|
else
|
@@ -24,7 +25,7 @@ class Attributes
|
|
24
25
|
when nil
|
25
26
|
coded_value
|
26
27
|
when "json"
|
27
|
-
|
28
|
+
MultiJson.load(coded_value)
|
28
29
|
when "jsonvalue"
|
29
30
|
::Kvom::Lib::JsonValue.load(coded_value)
|
30
31
|
else
|
@@ -52,7 +53,7 @@ class Attributes
|
|
52
53
|
::Kvom::Lib::JsonValue.dump(value)
|
53
54
|
when Array, Hash
|
54
55
|
@coding[name] = "json"
|
55
|
-
|
56
|
+
MultiJson.dump(value)
|
56
57
|
when String, Numeric
|
57
58
|
value
|
58
59
|
else
|
@@ -64,7 +65,7 @@ class Attributes
|
|
64
65
|
if @coding.empty?
|
65
66
|
@coded_attributes.delete("@meta.json")
|
66
67
|
else
|
67
|
-
@coded_attributes["@meta.json"] =
|
68
|
+
@coded_attributes["@meta.json"] = MultiJson.dump("coding" => @coding)
|
68
69
|
end
|
69
70
|
@coded_attributes
|
70
71
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'kvom/adapter'
|
2
|
+
require 'multi_json'
|
2
3
|
require 'fileutils'
|
3
4
|
require 'pathname'
|
4
5
|
|
@@ -86,7 +87,7 @@ class FilesystemAdapter < Base
|
|
86
87
|
rescue ::Errno::ENOENT
|
87
88
|
nil
|
88
89
|
else
|
89
|
-
FilesystemDocument.new(key,
|
90
|
+
FilesystemDocument.new(key, MultiJson.load(serialized_doc), true)
|
90
91
|
end
|
91
92
|
|
92
93
|
def filepath_for_document(doc)
|
data/lib/kvom/lib/json_value.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'kvom/lib'
|
2
|
+
require 'multi_json'
|
2
3
|
|
3
4
|
module Kvom; module Lib
|
4
5
|
|
@@ -15,7 +16,7 @@ module JsonValue
|
|
15
16
|
when ""
|
16
17
|
'""'
|
17
18
|
else
|
18
|
-
|
19
|
+
MultiJson.dump([primitive])[1..-2]
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -30,7 +31,7 @@ module JsonValue
|
|
30
31
|
when '""'
|
31
32
|
""
|
32
33
|
else
|
33
|
-
|
34
|
+
MultiJson.load("[#{jsonvalue_string}]").first
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
data/lib/kvom/storage/base.rb
CHANGED
@@ -21,8 +21,8 @@ class Base
|
|
21
21
|
|
22
22
|
def put(data)
|
23
23
|
id = generate_id
|
24
|
-
json_string =
|
25
|
-
normalized =
|
24
|
+
json_string = MultiJson.dump(data)
|
25
|
+
normalized = MultiJson.load(json_string)
|
26
26
|
write(id, normalized, json_string)
|
27
27
|
{"id" => id}
|
28
28
|
end
|
metadata
CHANGED
@@ -1,134 +1,135 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: kvom
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 6.8.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 6
|
8
|
-
- 8
|
9
|
-
- 0
|
10
|
-
- 539
|
11
|
-
- 93842523
|
12
|
-
version: 6.8.0.539.93842523
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Kristian Hanekamp, Infopark AG
|
16
9
|
autorequire:
|
17
10
|
bindir: bin
|
18
11
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2013-01-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: multi_json
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
version: "1"
|
33
|
-
version_requirements: *id001
|
34
|
-
name: multi_json
|
35
|
-
prerelease: false
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
36
22
|
type: :runtime
|
37
|
-
|
38
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
25
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
- 3
|
46
|
-
version: "3"
|
47
|
-
version_requirements: *id002
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
48
31
|
name: activesupport
|
49
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3'
|
50
38
|
type: :runtime
|
51
|
-
|
52
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
41
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
|
59
|
-
- 3
|
60
|
-
version: "3"
|
61
|
-
version_requirements: *id003
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
62
47
|
name: activemodel
|
63
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3'
|
64
54
|
type: :runtime
|
65
|
-
|
66
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
57
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
|
73
|
-
- 0
|
74
|
-
version: "0"
|
75
|
-
version_requirements: *id004
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3'
|
62
|
+
- !ruby/object:Gem::Dependency
|
76
63
|
name: rake
|
77
|
-
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
78
70
|
type: :development
|
79
|
-
|
80
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
73
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
86
|
-
|
87
|
-
- 2
|
88
|
-
- 8
|
89
|
-
version: "2.8"
|
90
|
-
version_requirements: *id005
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
91
79
|
name: rspec
|
92
|
-
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '2.8'
|
93
86
|
type: :development
|
94
|
-
|
95
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
89
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
101
|
-
|
102
|
-
- 0
|
103
|
-
version: "0"
|
104
|
-
version_requirements: *id006
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '2.8'
|
94
|
+
- !ruby/object:Gem::Dependency
|
105
95
|
name: helpful_configuration
|
106
|
-
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
107
102
|
type: :development
|
108
|
-
|
109
|
-
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
105
|
none: false
|
111
|
-
requirements:
|
112
|
-
- -
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
|
116
|
-
- 0
|
117
|
-
version: "0"
|
118
|
-
version_requirements: *id007
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
119
111
|
name: yajl-ruby
|
120
|
-
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
121
118
|
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
122
126
|
description: Use it to build object models in ruby on top of a key value store.
|
123
|
-
email:
|
127
|
+
email:
|
124
128
|
- kristian.hanekamp@infopark.de
|
125
129
|
executables: []
|
126
|
-
|
127
130
|
extensions: []
|
128
|
-
|
129
131
|
extra_rdoc_files: []
|
130
|
-
|
131
|
-
files:
|
132
|
+
files:
|
132
133
|
- .gitignore
|
133
134
|
- Gemfile
|
134
135
|
- Rakefile
|
@@ -144,7 +145,6 @@ files:
|
|
144
145
|
- lib/kvom/adapter/filesystem_document.rb
|
145
146
|
- lib/kvom/conflict.rb
|
146
147
|
- lib/kvom/lib.rb
|
147
|
-
- lib/kvom/lib/json.rb
|
148
148
|
- lib/kvom/lib/json_value.rb
|
149
149
|
- lib/kvom/model.rb
|
150
150
|
- lib/kvom/model/base.rb
|
@@ -163,7 +163,6 @@ files:
|
|
163
163
|
- spec/adapter/dynamodb_adapter_spec.rb
|
164
164
|
- spec/adapter/model_identity_spec.rb
|
165
165
|
- spec/cache_with_prefix_spec.rb
|
166
|
-
- spec/lib/json_spec.rb
|
167
166
|
- spec/model/all_ids_spec.rb
|
168
167
|
- spec/model/base_spec.rb
|
169
168
|
- spec/model/conflict_spec.rb
|
@@ -174,46 +173,38 @@ files:
|
|
174
173
|
- spec/support/model.rb
|
175
174
|
- spec/support/test_ids.rb
|
176
175
|
- tmp/.gitignore
|
177
|
-
|
178
|
-
homepage: ""
|
176
|
+
homepage: ''
|
179
177
|
licenses: []
|
180
|
-
|
181
178
|
post_install_message:
|
182
179
|
rdoc_options: []
|
183
|
-
|
184
|
-
require_paths:
|
180
|
+
require_paths:
|
185
181
|
- lib
|
186
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
187
183
|
none: false
|
188
|
-
requirements:
|
189
|
-
- -
|
190
|
-
- !ruby/object:Gem::Version
|
191
|
-
|
192
|
-
segments:
|
184
|
+
requirements:
|
185
|
+
- - ! '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
segments:
|
193
189
|
- 0
|
194
|
-
|
195
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
hash: -89310097
|
191
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
192
|
none: false
|
197
|
-
requirements:
|
198
|
-
- -
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
|
201
|
-
segments:
|
202
|
-
- 0
|
203
|
-
version: "0"
|
193
|
+
requirements:
|
194
|
+
- - ! '>='
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
204
197
|
requirements: []
|
205
|
-
|
206
198
|
rubyforge_project: kvom
|
207
|
-
rubygems_version: 1.
|
199
|
+
rubygems_version: 1.8.23
|
208
200
|
signing_key:
|
209
201
|
specification_version: 3
|
210
202
|
summary: Key Value Object Mapper
|
211
|
-
test_files:
|
203
|
+
test_files:
|
212
204
|
- spec/adapter/counter_spec.rb
|
213
205
|
- spec/adapter/dynamodb_adapter_spec.rb
|
214
206
|
- spec/adapter/model_identity_spec.rb
|
215
207
|
- spec/cache_with_prefix_spec.rb
|
216
|
-
- spec/lib/json_spec.rb
|
217
208
|
- spec/model/all_ids_spec.rb
|
218
209
|
- spec/model/base_spec.rb
|
219
210
|
- spec/model/conflict_spec.rb
|
@@ -223,3 +214,4 @@ test_files:
|
|
223
214
|
- spec/support/adapter.rb
|
224
215
|
- spec/support/model.rb
|
225
216
|
- spec/support/test_ids.rb
|
217
|
+
has_rdoc:
|
data/lib/kvom/lib/json.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'kvom/lib'
|
2
|
-
require 'multi_json'
|
3
|
-
|
4
|
-
::Kvom::Lib::Json = ::MultiJson if (%w[dump load] - ::MultiJson.singleton_methods).empty?
|
5
|
-
|
6
|
-
module Kvom::Lib::Json
|
7
|
-
def self.dump(*args)
|
8
|
-
::MultiJson.encode(*args)
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.load(*args)
|
12
|
-
::MultiJson.decode(*args)
|
13
|
-
end
|
14
|
-
end unless defined?(Kvom::Lib::Json)
|
data/spec/lib/json_spec.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ::Kvom::Lib::Json do
|
4
|
-
|
5
|
-
context "when MultiJson is new style (methods are dump and load)", :multi_json_version => ">= 1.3.0" do
|
6
|
-
it "is MultiJson" do
|
7
|
-
::Kvom::Lib::Json.should == ::MultiJson
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
context "when MultiJson is old style (methods are encode and decode)", :multi_json_version => "< 1.3.0" do
|
12
|
-
|
13
|
-
let(:ruby_object) {[1, nil, true, false, [], {}]}
|
14
|
-
let(:json_string) {'[1,null,true,false,[],{}]'}
|
15
|
-
|
16
|
-
it "forwards .dump to MultiJson.encode" do
|
17
|
-
MultiJson.should_receive(:encode).with(ruby_object).and_return(json_string)
|
18
|
-
|
19
|
-
Kvom::Lib::Json.dump(ruby_object).should be_equal(json_string)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "forwards .load to MultiJson.decode" do
|
23
|
-
MultiJson.should_receive(:decode).with(json_string).and_return(ruby_object)
|
24
|
-
|
25
|
-
Kvom::Lib::Json.load(json_string).should be_equal(ruby_object)
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|