riagent 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +21 -19
- data/README.md +1 -1
- data/lib/riagent/associations.rb +38 -3
- data/lib/riagent/persistence/riak_dt_set_strategy.rb +2 -0
- data/lib/riagent/version.rb +1 -1
- data/riagent.gemspec +4 -4
- data/test/examples/models/user.rb +1 -1
- data/test/unit/active_model_lint_test.rb +2 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c9ddd9164ae5cb78a66eb3e92cf0daaa50742f0
|
4
|
+
data.tar.gz: b00db3ceb9da849ac50370eb2064d2c444708749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9799420123fe3cd8ed4a553957c87cffb6ba8eddb0e2e9be259c5e43261394629019da4964018138370752b73e71cc5ffcd1a16f999bc42cc586f009cbb6830f
|
7
|
+
data.tar.gz: 7367ada3910a6e2959cf60aa10d0bf3333844ae93439af6b99bafbfbd00062c7fec238bc1d948176c01c7be5fd43c3c9975f05a51c8e5cac9719ccbc0c3b9aa7
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
riagent (0.1.
|
5
|
-
activemodel (~> 4.
|
6
|
-
activesupport (~> 4.
|
7
|
-
riagent-document (= 0.0.
|
4
|
+
riagent (0.1.1)
|
5
|
+
activemodel (~> 4.2)
|
6
|
+
activesupport (~> 4.2)
|
7
|
+
riagent-document (= 0.0.2)
|
8
8
|
riak-client (~> 2.2)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activemodel (4.
|
14
|
-
activesupport (= 4.
|
15
|
-
builder (~> 3.1
|
16
|
-
activesupport (4.
|
17
|
-
i18n (~> 0.
|
18
|
-
|
19
|
-
|
20
|
-
thread_safe (~> 0.
|
21
|
-
tzinfo (~>
|
13
|
+
activemodel (4.2.4)
|
14
|
+
activesupport (= 4.2.4)
|
15
|
+
builder (~> 3.1)
|
16
|
+
activesupport (4.2.4)
|
17
|
+
i18n (~> 0.7)
|
18
|
+
json (~> 1.7, >= 1.7.7)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
21
|
+
tzinfo (~> 1.1)
|
22
22
|
axiom-types (0.1.1)
|
23
23
|
descendants_tracker (~> 0.0.4)
|
24
24
|
ice_nine (~> 0.11.0)
|
25
25
|
thread_safe (~> 0.3, >= 0.3.1)
|
26
26
|
beefcake (1.1.0)
|
27
|
-
builder (3.
|
27
|
+
builder (3.2.2)
|
28
28
|
cert_validator (0.0.1)
|
29
29
|
coercible (1.0.0)
|
30
30
|
descendants_tracker (~> 0.0.1)
|
@@ -34,12 +34,13 @@ GEM
|
|
34
34
|
i18n (0.7.0)
|
35
35
|
ice_nine (0.11.1)
|
36
36
|
innertube (1.0.2)
|
37
|
-
|
37
|
+
json (1.8.3)
|
38
|
+
minitest (5.8.0)
|
38
39
|
minitest-spec-context (0.0.3)
|
39
40
|
multi_json (1.11.2)
|
40
41
|
rake (10.3.2)
|
41
|
-
riagent-document (0.0.
|
42
|
-
activesupport (~> 4.
|
42
|
+
riagent-document (0.0.2)
|
43
|
+
activesupport (~> 4.2)
|
43
44
|
virtus
|
44
45
|
riak-client (2.2.1)
|
45
46
|
beefcake (~> 1.1)
|
@@ -48,7 +49,8 @@ GEM
|
|
48
49
|
innertube (~> 1.0.2)
|
49
50
|
multi_json (~> 1.0)
|
50
51
|
thread_safe (0.3.5)
|
51
|
-
tzinfo (
|
52
|
+
tzinfo (1.2.2)
|
53
|
+
thread_safe (~> 0.1)
|
52
54
|
virtus (1.0.5)
|
53
55
|
axiom-types (~> 0.1)
|
54
56
|
coercible (~> 1.0)
|
@@ -60,7 +62,7 @@ PLATFORMS
|
|
60
62
|
|
61
63
|
DEPENDENCIES
|
62
64
|
bundler
|
63
|
-
minitest (~>
|
65
|
+
minitest (~> 5.1)
|
64
66
|
minitest-spec-context
|
65
67
|
rake
|
66
68
|
riagent!
|
data/README.md
CHANGED
data/lib/riagent/associations.rb
CHANGED
@@ -25,20 +25,55 @@ module Riagent
|
|
25
25
|
extend ActiveSupport::Concern
|
26
26
|
|
27
27
|
module ClassMethods
|
28
|
+
# Creates a has_many association
|
29
|
+
#
|
30
|
+
# @param options [Hash] Association options
|
31
|
+
# @option options [Symbol] :using The query type/mechanism for this association
|
32
|
+
# @option options [Symbol] :class Target class for the association
|
28
33
|
def has_many(name, options={})
|
29
34
|
query_type = options[:using]
|
30
35
|
target_class = options[:class]
|
31
36
|
case query_type
|
37
|
+
when :key_set
|
38
|
+
has_many_using_key_set(name, target_class, options)
|
32
39
|
when :solr
|
33
|
-
has_many_using_solr(name, target_class,
|
40
|
+
has_many_using_solr(name, target_class, options)
|
34
41
|
else
|
35
42
|
raise ArgumentError, ":using query type not supported"
|
36
43
|
end
|
37
44
|
end
|
38
45
|
|
39
|
-
#
|
46
|
+
# Creates a has_many association, where the collection will be loaded
|
47
|
+
# from an external crdt Set containing the child keys
|
48
|
+
#
|
49
|
+
# @param name [String] Association name
|
50
|
+
# @param target_class [Class] Target class
|
51
|
+
# @param options [Hash] Association options (currently unused)
|
52
|
+
def has_many_using_key_set(name, target_class, options)
|
53
|
+
# Create a <target name>_cache attribute accessors
|
54
|
+
# These will be used to store the actual loaded collection
|
55
|
+
target_cache_attribute = "#{name}_cache".to_sym
|
56
|
+
attr_accessor target_cache_attribute
|
57
|
+
|
58
|
+
# Create the getter method
|
59
|
+
# Example: for 'has_many :posts', the getter method is :posts
|
60
|
+
target_getter_method = "#{name}".to_sym
|
61
|
+
|
62
|
+
define_method(target_getter_method) do
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
# Create the setter method=
|
67
|
+
# Example: for 'has_many :posts', the setter method is :posts=
|
68
|
+
target_setter_method = "#{name}=".to_sym
|
69
|
+
|
70
|
+
define_method(target_setter_method) do | target |
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Creates a has_many association where the collection will be loaded
|
40
75
|
# via Solr queries.
|
41
|
-
def has_many_using_solr(name, target_class,
|
76
|
+
def has_many_using_solr(name, target_class, options)
|
42
77
|
target_getter_method = "#{name}".to_sym
|
43
78
|
|
44
79
|
# Create a <target name>_cache attribute accessors
|
@@ -91,6 +91,8 @@ module Riagent
|
|
91
91
|
self.client.bucket('_rg_key_lists')
|
92
92
|
end
|
93
93
|
|
94
|
+
# Delete a document from a collection, and delete its key from the key list set
|
95
|
+
# @param [Riagent::ActiveDocument] document Document to be removed
|
94
96
|
def remove(document)
|
95
97
|
doc_key = document.key
|
96
98
|
super
|
data/lib/riagent/version.rb
CHANGED
data/riagent.gemspec
CHANGED
@@ -39,12 +39,12 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.require_paths = ["lib"]
|
40
40
|
|
41
41
|
spec.add_runtime_dependency "riak-client", "~> 2.2"
|
42
|
-
spec.add_runtime_dependency "riagent-document", "0.0.
|
43
|
-
spec.add_runtime_dependency "activemodel", "~> 4.
|
44
|
-
spec.add_runtime_dependency "activesupport", "~> 4.
|
42
|
+
spec.add_runtime_dependency "riagent-document", "0.0.2"
|
43
|
+
spec.add_runtime_dependency "activemodel", "~> 4.2"
|
44
|
+
spec.add_runtime_dependency "activesupport", "~> 4.2"
|
45
45
|
|
46
46
|
spec.add_development_dependency "bundler"
|
47
47
|
spec.add_development_dependency "rake"
|
48
|
-
spec.add_development_dependency "minitest", "~>
|
48
|
+
spec.add_development_dependency "minitest", "~> 5.1"
|
49
49
|
spec.add_development_dependency "minitest-spec-context"
|
50
50
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
## -------------------------------------------------------------------
|
2
2
|
##
|
3
|
-
## Copyright (c) "2014" Dmitri Zagidulin and Basho Technologies, Inc.
|
3
|
+
## Copyright (c) "2014-2015" Dmitri Zagidulin and Basho Technologies, Inc.
|
4
4
|
##
|
5
5
|
## This file is provided to you under the Apache License,
|
6
6
|
## Version 2.0 (the "License"); you may not use this file
|
@@ -23,7 +23,7 @@ require 'active_model/lint'
|
|
23
23
|
|
24
24
|
# Runs the ActiveModel::Lint test suite, to make sure a model fits the ActiveModel API
|
25
25
|
# See http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/
|
26
|
-
class ActiveModelLintTest < Minitest::
|
26
|
+
class ActiveModelLintTest < Minitest::Test
|
27
27
|
include ActiveModel::Lint::Tests
|
28
28
|
|
29
29
|
def setup
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riagent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitri Zagidulin
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activemodel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '4.
|
47
|
+
version: '4.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '4.
|
54
|
+
version: '4.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activesupport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '4.
|
61
|
+
version: '4.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '4.
|
68
|
+
version: '4.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '5.1'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '5.1'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest-spec-context
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,3 +221,4 @@ test_files:
|
|
221
221
|
- test/unit/persistence_riak_no_index_test.rb
|
222
222
|
- test/unit/persistence_test.rb
|
223
223
|
- test/unit/validation_test.rb
|
224
|
+
has_rdoc:
|