redis_orm 0.7 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1 -1
  3. data/lib/redis_orm.rb +8 -13
  4. data/lib/redis_orm/associations/has_many.rb +7 -3
  5. data/lib/redis_orm/redis_orm.rb +3 -5
  6. metadata +64 -124
  7. data/Gemfile +0 -10
  8. data/Manifest +0 -74
  9. data/Rakefile +0 -25
  10. data/benchmarks/sortable_benchmark.rb +0 -45
  11. data/redis_orm.gemspec +0 -45
  12. data/spec/generators/model_generator_spec.rb +0 -29
  13. data/spec/spec_helper.rb +0 -17
  14. data/test/association_indices_test.rb +0 -168
  15. data/test/associations_test.rb +0 -294
  16. data/test/atomicity_test.rb +0 -36
  17. data/test/basic_functionality_test.rb +0 -204
  18. data/test/callbacks_test.rb +0 -49
  19. data/test/changes_array_test.rb +0 -25
  20. data/test/classes/album.rb +0 -6
  21. data/test/classes/article.rb +0 -7
  22. data/test/classes/article_with_comments.rb +0 -8
  23. data/test/classes/book.rb +0 -6
  24. data/test/classes/catalog_item.rb +0 -5
  25. data/test/classes/category.rb +0 -7
  26. data/test/classes/city.rb +0 -7
  27. data/test/classes/comment.rb +0 -26
  28. data/test/classes/country.rb +0 -5
  29. data/test/classes/custom_user.rb +0 -8
  30. data/test/classes/cutout.rb +0 -20
  31. data/test/classes/cutout_aggregator.rb +0 -5
  32. data/test/classes/default_user.rb +0 -10
  33. data/test/classes/dynamic_finder_user.rb +0 -8
  34. data/test/classes/empty_person.rb +0 -2
  35. data/test/classes/expire_user.rb +0 -8
  36. data/test/classes/expire_user_with_predicate.rb +0 -13
  37. data/test/classes/giftcard.rb +0 -6
  38. data/test/classes/jigsaw.rb +0 -4
  39. data/test/classes/location.rb +0 -5
  40. data/test/classes/message.rb +0 -4
  41. data/test/classes/note.rb +0 -5
  42. data/test/classes/omni_user.rb +0 -8
  43. data/test/classes/person.rb +0 -6
  44. data/test/classes/photo.rb +0 -21
  45. data/test/classes/profile.rb +0 -9
  46. data/test/classes/sortable_user.rb +0 -11
  47. data/test/classes/timestamp.rb +0 -3
  48. data/test/classes/user.rb +0 -39
  49. data/test/classes/uuid_default_user.rb +0 -12
  50. data/test/classes/uuid_timestamp.rb +0 -5
  51. data/test/classes/uuid_user.rb +0 -13
  52. data/test/dynamic_finders_test.rb +0 -51
  53. data/test/exceptions_test.rb +0 -47
  54. data/test/expire_records_test.rb +0 -64
  55. data/test/has_one_has_many_test.rb +0 -42
  56. data/test/indices_test.rb +0 -63
  57. data/test/modules/belongs_to_model_within_module.rb +0 -6
  58. data/test/modules/has_many_model_within_module.rb +0 -11
  59. data/test/options_test.rb +0 -226
  60. data/test/polymorphic_test.rb +0 -65
  61. data/test/redis.conf +0 -417
  62. data/test/sortable_test.rb +0 -116
  63. data/test/test_helper.rb +0 -37
  64. data/test/uuid_as_id_test.rb +0 -178
  65. data/test/validations_test.rb +0 -20
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2ca054af9087bbd76a32022f1fee369a5ef0292c15e1b091fddbab2aadb2649f
4
+ data.tar.gz: 142417a34ecdd550195ec800aff8157d24c5cde06601e69a99c2916d23577e5c
5
+ SHA512:
6
+ metadata.gz: 7855dfe1ea7f968d17546eb9ff1ade0d9a50b7548f1a297a31cd1ecd1d60329c89dcefedf6affbc107634425b4f0a3828b6b573a5fa46d807c4167e0cea9dbc3
7
+ data.tar.gz: 2313d1c202ca558573468a93ec4d47beb278069b454e245aaeb65280ce8bc891ac1e89e03df85980c303787ea1e15f4f4220ba61d2f515823b05dcb1a8e939a6
data/README.md CHANGED
@@ -46,7 +46,7 @@ bundle install
46
46
  To run the tests you should have redis installed already. Please check [Redis download/installation page](http://redis.io/download).
47
47
 
48
48
  ```sh
49
- rake test
49
+ rspec
50
50
  ```
51
51
 
52
52
  ## Setting up a connection to the redis server
data/lib/redis_orm.rb CHANGED
@@ -1,19 +1,14 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'active_model'
4
2
  require 'redis'
5
3
  require 'uuid'
6
- require File.join(File.dirname(File.expand_path(__FILE__)), 'redis_orm', 'active_model_behavior')
7
-
8
- require File.join(File.dirname(File.expand_path(__FILE__)), 'redis_orm', 'associations', 'belongs_to')
9
-
10
- require File.join(File.dirname(File.expand_path(__FILE__)), 'redis_orm', 'associations', 'has_many_helper')
11
-
12
- require File.join(File.dirname(File.expand_path(__FILE__)), 'redis_orm', 'associations', 'has_many_proxy')
13
- require File.join(File.dirname(File.expand_path(__FILE__)), 'redis_orm', 'associations', 'has_many')
14
- require File.join(File.dirname(File.expand_path(__FILE__)), 'redis_orm', 'associations', 'has_one')
15
4
 
16
- require File.join(File.dirname(File.expand_path(__FILE__)), 'redis_orm', 'utils')
5
+ require_relative 'redis_orm/active_model_behavior'
6
+ require_relative 'redis_orm/associations/belongs_to'
7
+ require_relative 'redis_orm/associations/has_many_helper'
8
+ require_relative 'redis_orm/associations/has_many_proxy'
9
+ require_relative 'redis_orm/associations/has_many'
10
+ require_relative 'redis_orm/associations/has_one'
11
+ require_relative 'redis_orm/utils'
17
12
 
18
13
  class String
19
14
  def i18n_key
@@ -25,4 +20,4 @@ class String
25
20
  end
26
21
  end
27
22
 
28
- require File.join(File.dirname(File.expand_path(__FILE__)), 'redis_orm', 'redis_orm')
23
+ require_relative 'redis_orm/redis_orm'
@@ -22,9 +22,13 @@ module RedisOrm
22
22
  old_records = self.send(foreign_models).to_a
23
23
  if !old_records.empty?
24
24
  # cache here which association with current model have old record's model
25
- has_many_assoc = old_records[0].get_associations.detect{|h| h[:type] == :has_many && h[:foreign_models] == model_name.pluralize.to_sym}
25
+ has_many_assoc = old_records[0].get_associations.detect do |h|
26
+ h[:type] == :has_many && h[:foreign_models] == model_name.pluralize.to_sym
27
+ end
26
28
 
27
- has_one_or_belongs_to_assoc = old_records[0].get_associations.detect{|h| [:has_one, :belongs_to].include?(h[:type]) && h[:foreign_model] == model_name.to_sym}
29
+ has_one_or_belongs_to_assoc = old_records[0].get_associations.detect do |h|
30
+ [:has_one, :belongs_to].include?(h[:type]) && h[:foreign_model] == model_name.to_sym
31
+ end
28
32
 
29
33
  old_records.each do |record|
30
34
  if has_many_assoc
@@ -72,4 +76,4 @@ module RedisOrm
72
76
  end
73
77
  end
74
78
  end
75
- end
79
+ end
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require 'active_support/inflector/inflections'
4
2
  require 'active_support/inflector/transliterate'
5
3
  require 'active_support/inflector/methods'
@@ -9,7 +7,7 @@ require 'active_support/core_ext/string/inflections'
9
7
  require 'active_support/core_ext/time/acts_like'
10
8
  require 'active_support/core_ext/time/calculations'
11
9
  require 'active_support/core_ext/time/conversions'
12
- require 'active_support/core_ext/time/marshal'
10
+ #require 'active_support/core_ext/time/marshal'
13
11
  require 'active_support/core_ext/time/zones'
14
12
 
15
13
  require 'active_support/core_ext/numeric'
@@ -133,7 +131,7 @@ module RedisOrm
133
131
  end
134
132
 
135
133
  def expire(seconds, options = {})
136
- @@expire[model_name] = {:seconds => seconds, :options => options}
134
+ @@expire[model_name] = {seconds: seconds, options: options}
137
135
  end
138
136
 
139
137
  def use_uuid_as_id
@@ -223,7 +221,7 @@ module RedisOrm
223
221
  end
224
222
  end
225
223
 
226
- index = find_indices(properties, :first => true)
224
+ index = find_indices(properties, {first: true})
227
225
 
228
226
  raise NotIndexFound if !index
229
227
 
metadata CHANGED
@@ -1,96 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_orm
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
5
- prerelease:
4
+ version: '0.8'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dmitrii Samoilov
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-03 00:00:00.000000000 Z
11
+ date: 2021-02-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 3.0.0
19
+ version: '5.1'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: 3.0.0
26
+ version: '5.1'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activemodel
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: 3.0.0
33
+ version: '5.1'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: 3.0.0
40
+ version: '5.1'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: redis
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: 2.2.0
47
+ version: 4.2.5
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: 2.2.0
54
+ version: 4.2.5
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: uuid
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: 2.3.2
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: 2.3.2
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
- version: 2.5.0
75
+ version: '3.10'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
- version: 2.5.0
82
+ version: '3.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: ammeter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.1'
94
111
  description: ORM for Redis (advanced key-value storage) with ActiveRecord API
95
112
  email: germaninthetown@gmail.com
96
113
  executables: []
@@ -113,13 +130,9 @@ extra_rdoc_files:
113
130
  - lib/redis_orm/utils.rb
114
131
  files:
115
132
  - CHANGELOG
116
- - Gemfile
117
133
  - LICENSE
118
- - Manifest
119
134
  - README.md
120
- - Rakefile
121
135
  - TODO
122
- - benchmarks/sortable_benchmark.rb
123
136
  - lib/rails/generators/redis_orm/model/model_generator.rb
124
137
  - lib/rails/generators/redis_orm/model/templates/model.rb.erb
125
138
  - lib/redis_orm.rb
@@ -131,106 +144,33 @@ files:
131
144
  - lib/redis_orm/associations/has_one.rb
132
145
  - lib/redis_orm/redis_orm.rb
133
146
  - lib/redis_orm/utils.rb
134
- - redis_orm.gemspec
135
- - spec/generators/model_generator_spec.rb
136
- - spec/spec_helper.rb
137
- - test/association_indices_test.rb
138
- - test/associations_test.rb
139
- - test/atomicity_test.rb
140
- - test/basic_functionality_test.rb
141
- - test/callbacks_test.rb
142
- - test/changes_array_test.rb
143
- - test/classes/album.rb
144
- - test/classes/article.rb
145
- - test/classes/article_with_comments.rb
146
- - test/classes/book.rb
147
- - test/classes/catalog_item.rb
148
- - test/classes/category.rb
149
- - test/classes/city.rb
150
- - test/classes/comment.rb
151
- - test/classes/country.rb
152
- - test/classes/custom_user.rb
153
- - test/classes/cutout.rb
154
- - test/classes/cutout_aggregator.rb
155
- - test/classes/default_user.rb
156
- - test/classes/dynamic_finder_user.rb
157
- - test/classes/empty_person.rb
158
- - test/classes/expire_user.rb
159
- - test/classes/expire_user_with_predicate.rb
160
- - test/classes/giftcard.rb
161
- - test/classes/jigsaw.rb
162
- - test/classes/location.rb
163
- - test/classes/message.rb
164
- - test/classes/note.rb
165
- - test/classes/omni_user.rb
166
- - test/classes/person.rb
167
- - test/classes/photo.rb
168
- - test/classes/profile.rb
169
- - test/classes/sortable_user.rb
170
- - test/classes/timestamp.rb
171
- - test/classes/user.rb
172
- - test/classes/uuid_default_user.rb
173
- - test/classes/uuid_timestamp.rb
174
- - test/classes/uuid_user.rb
175
- - test/dynamic_finders_test.rb
176
- - test/exceptions_test.rb
177
- - test/expire_records_test.rb
178
- - test/has_one_has_many_test.rb
179
- - test/indices_test.rb
180
- - test/modules/belongs_to_model_within_module.rb
181
- - test/modules/has_many_model_within_module.rb
182
- - test/options_test.rb
183
- - test/polymorphic_test.rb
184
- - test/redis.conf
185
- - test/sortable_test.rb
186
- - test/test_helper.rb
187
- - test/uuid_as_id_test.rb
188
- - test/validations_test.rb
189
147
  homepage: https://github.com/german/redis_orm
190
- licenses: []
191
- post_install_message:
148
+ licenses:
149
+ - MIT
150
+ metadata: {}
151
+ post_install_message:
192
152
  rdoc_options:
193
- - --line-numbers
194
- - --inline-source
195
- - --title
153
+ - "--line-numbers"
154
+ - "--inline-source"
155
+ - "--title"
196
156
  - Redis_orm
197
- - --main
157
+ - "--main"
198
158
  - README.md
199
159
  require_paths:
200
160
  - lib
201
161
  required_ruby_version: !ruby/object:Gem::Requirement
202
- none: false
203
162
  requirements:
204
- - - ! '>='
163
+ - - ">="
205
164
  - !ruby/object:Gem::Version
206
165
  version: '0'
207
166
  required_rubygems_version: !ruby/object:Gem::Requirement
208
- none: false
209
167
  requirements:
210
- - - ! '>='
168
+ - - ">="
211
169
  - !ruby/object:Gem::Version
212
- version: '1.2'
170
+ version: '0'
213
171
  requirements: []
214
- rubyforge_project: redis_orm
215
- rubygems_version: 1.8.25
216
- signing_key:
217
- specification_version: 3
172
+ rubygems_version: 3.0.3
173
+ signing_key:
174
+ specification_version: 4
218
175
  summary: ORM for Redis (advanced key-value storage) with ActiveRecord API
219
- test_files:
220
- - test/association_indices_test.rb
221
- - test/associations_test.rb
222
- - test/atomicity_test.rb
223
- - test/basic_functionality_test.rb
224
- - test/callbacks_test.rb
225
- - test/changes_array_test.rb
226
- - test/dynamic_finders_test.rb
227
- - test/exceptions_test.rb
228
- - test/expire_records_test.rb
229
- - test/has_one_has_many_test.rb
230
- - test/indices_test.rb
231
- - test/options_test.rb
232
- - test/polymorphic_test.rb
233
- - test/sortable_test.rb
234
- - test/test_helper.rb
235
- - test/uuid_as_id_test.rb
236
- - test/validations_test.rb
176
+ test_files: []
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :test do
6
- gem 'rspec', '>= 2.5.0'
7
- #gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
8
- #gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
9
- #gem 'ruby-debug19'
10
- end
data/Manifest DELETED
@@ -1,74 +0,0 @@
1
- CHANGELOG
2
- Gemfile
3
- LICENSE
4
- Manifest
5
- README.md
6
- Rakefile
7
- TODO
8
- benchmarks/sortable_benchmark.rb
9
- lib/rails/generators/redis_orm/model/model_generator.rb
10
- lib/rails/generators/redis_orm/model/templates/model.rb.erb
11
- lib/redis_orm.rb
12
- lib/redis_orm/active_model_behavior.rb
13
- lib/redis_orm/associations/belongs_to.rb
14
- lib/redis_orm/associations/has_many.rb
15
- lib/redis_orm/associations/has_many_helper.rb
16
- lib/redis_orm/associations/has_many_proxy.rb
17
- lib/redis_orm/associations/has_one.rb
18
- lib/redis_orm/redis_orm.rb
19
- lib/redis_orm/utils.rb
20
- redis_orm.gemspec
21
- spec/generators/model_generator_spec.rb
22
- spec/spec_helper.rb
23
- test/association_indices_test.rb
24
- test/associations_test.rb
25
- test/atomicity_test.rb
26
- test/basic_functionality_test.rb
27
- test/callbacks_test.rb
28
- test/changes_array_test.rb
29
- test/classes/album.rb
30
- test/classes/article.rb
31
- test/classes/article_with_comments.rb
32
- test/classes/book.rb
33
- test/classes/catalog_item.rb
34
- test/classes/category.rb
35
- test/classes/city.rb
36
- test/classes/comment.rb
37
- test/classes/country.rb
38
- test/classes/custom_user.rb
39
- test/classes/cutout.rb
40
- test/classes/cutout_aggregator.rb
41
- test/classes/default_user.rb
42
- test/classes/dynamic_finder_user.rb
43
- test/classes/empty_person.rb
44
- test/classes/expire_user.rb
45
- test/classes/expire_user_with_predicate.rb
46
- test/classes/giftcard.rb
47
- test/classes/jigsaw.rb
48
- test/classes/location.rb
49
- test/classes/message.rb
50
- test/classes/note.rb
51
- test/classes/omni_user.rb
52
- test/classes/person.rb
53
- test/classes/photo.rb
54
- test/classes/profile.rb
55
- test/classes/sortable_user.rb
56
- test/classes/timestamp.rb
57
- test/classes/user.rb
58
- test/classes/uuid_default_user.rb
59
- test/classes/uuid_timestamp.rb
60
- test/classes/uuid_user.rb
61
- test/dynamic_finders_test.rb
62
- test/exceptions_test.rb
63
- test/expire_records_test.rb
64
- test/has_one_has_many_test.rb
65
- test/indices_test.rb
66
- test/modules/belongs_to_model_within_module.rb
67
- test/modules/has_many_model_within_module.rb
68
- test/options_test.rb
69
- test/polymorphic_test.rb
70
- test/redis.conf
71
- test/sortable_test.rb
72
- test/test_helper.rb
73
- test/uuid_as_id_test.rb
74
- test/validations_test.rb