redis_orm 0.6.2 → 0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{redis_orm}
5
- s.version = "0.6.2"
4
+ s.name = "redis_orm"
5
+ s.version = "0.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{Dmitrii Samoilov}]
9
- s.date = %q{2012-05-23}
10
- s.description = %q{ORM for Redis (advanced key-value storage) with ActiveRecord API}
11
- s.email = %q{germaninthetown@gmail.com}
12
- s.extra_rdoc_files = [%q{CHANGELOG}, %q{LICENSE}, %q{README.md}, %q{TODO}, %q{lib/redis_orm.rb}, %q{lib/redis_orm/active_model_behavior.rb}, %q{lib/redis_orm/associations/belongs_to.rb}, %q{lib/redis_orm/associations/has_many.rb}, %q{lib/redis_orm/associations/has_many_helper.rb}, %q{lib/redis_orm/associations/has_many_proxy.rb}, %q{lib/redis_orm/associations/has_one.rb}, %q{lib/redis_orm/redis_orm.rb}, %q{lib/redis_orm/utils.rb}]
13
- s.files = [%q{CHANGELOG}, %q{Gemfile}, %q{LICENSE}, %q{Manifest}, %q{README.md}, %q{Rakefile}, %q{TODO}, %q{benchmarks/sortable_benchmark.rb}, %q{lib/redis_orm.rb}, %q{lib/redis_orm/active_model_behavior.rb}, %q{lib/redis_orm/associations/belongs_to.rb}, %q{lib/redis_orm/associations/has_many.rb}, %q{lib/redis_orm/associations/has_many_helper.rb}, %q{lib/redis_orm/associations/has_many_proxy.rb}, %q{lib/redis_orm/associations/has_one.rb}, %q{lib/redis_orm/redis_orm.rb}, %q{lib/redis_orm/utils.rb}, %q{redis_orm.gemspec}, %q{test/association_indices_test.rb}, %q{test/associations_test.rb}, %q{test/atomicity_test.rb}, %q{test/basic_functionality_test.rb}, %q{test/callbacks_test.rb}, %q{test/changes_array_test.rb}, %q{test/classes/album.rb}, %q{test/classes/article.rb}, %q{test/classes/book.rb}, %q{test/classes/catalog_item.rb}, %q{test/classes/category.rb}, %q{test/classes/city.rb}, %q{test/classes/comment.rb}, %q{test/classes/country.rb}, %q{test/classes/custom_user.rb}, %q{test/classes/cutout.rb}, %q{test/classes/cutout_aggregator.rb}, %q{test/classes/default_user.rb}, %q{test/classes/dynamic_finder_user.rb}, %q{test/classes/empty_person.rb}, %q{test/classes/giftcard.rb}, %q{test/classes/jigsaw.rb}, %q{test/classes/location.rb}, %q{test/classes/message.rb}, %q{test/classes/note.rb}, %q{test/classes/omni_user.rb}, %q{test/classes/person.rb}, %q{test/classes/photo.rb}, %q{test/classes/profile.rb}, %q{test/classes/sortable_user.rb}, %q{test/classes/timestamp.rb}, %q{test/classes/user.rb}, %q{test/classes/uuid_default_user.rb}, %q{test/classes/uuid_timestamp.rb}, %q{test/classes/uuid_user.rb}, %q{test/dynamic_finders_test.rb}, %q{test/exceptions_test.rb}, %q{test/has_one_has_many_test.rb}, %q{test/indices_test.rb}, %q{test/modules/belongs_to_model_within_module.rb}, %q{test/modules/has_many_model_within_module.rb}, %q{test/options_test.rb}, %q{test/polymorphic_test.rb}, %q{test/redis.conf}, %q{test/sortable_test.rb}, %q{test/test_helper.rb}, %q{test/uuid_as_id_test.rb}, %q{test/validations_test.rb}]
14
- s.homepage = %q{https://github.com/german/redis_orm}
15
- s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Redis_orm}, %q{--main}, %q{README.md}]
16
- s.require_paths = [%q{lib}]
17
- s.rubyforge_project = %q{redis_orm}
18
- s.rubygems_version = %q{1.8.6}
19
- s.summary = %q{ORM for Redis (advanced key-value storage) with ActiveRecord API}
20
- s.test_files = [%q{test/atomicity_test.rb}, %q{test/indices_test.rb}, %q{test/sortable_test.rb}, %q{test/uuid_as_id_test.rb}, %q{test/test_helper.rb}, %q{test/options_test.rb}, %q{test/callbacks_test.rb}, %q{test/exceptions_test.rb}, %q{test/associations_test.rb}, %q{test/validations_test.rb}, %q{test/basic_functionality_test.rb}, %q{test/dynamic_finders_test.rb}, %q{test/changes_array_test.rb}, %q{test/polymorphic_test.rb}, %q{test/association_indices_test.rb}, %q{test/has_one_has_many_test.rb}]
8
+ s.authors = ["Dmitrii Samoilov"]
9
+ s.date = "2013-05-03"
10
+ s.description = "ORM for Redis (advanced key-value storage) with ActiveRecord API"
11
+ s.email = "germaninthetown@gmail.com"
12
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.md", "TODO", "lib/rails/generators/redis_orm/model/model_generator.rb", "lib/rails/generators/redis_orm/model/templates/model.rb.erb", "lib/redis_orm.rb", "lib/redis_orm/active_model_behavior.rb", "lib/redis_orm/associations/belongs_to.rb", "lib/redis_orm/associations/has_many.rb", "lib/redis_orm/associations/has_many_helper.rb", "lib/redis_orm/associations/has_many_proxy.rb", "lib/redis_orm/associations/has_one.rb", "lib/redis_orm/redis_orm.rb", "lib/redis_orm/utils.rb"]
13
+ s.files = ["CHANGELOG", "Gemfile", "LICENSE", "Manifest", "README.md", "Rakefile", "TODO", "benchmarks/sortable_benchmark.rb", "lib/rails/generators/redis_orm/model/model_generator.rb", "lib/rails/generators/redis_orm/model/templates/model.rb.erb", "lib/redis_orm.rb", "lib/redis_orm/active_model_behavior.rb", "lib/redis_orm/associations/belongs_to.rb", "lib/redis_orm/associations/has_many.rb", "lib/redis_orm/associations/has_many_helper.rb", "lib/redis_orm/associations/has_many_proxy.rb", "lib/redis_orm/associations/has_one.rb", "lib/redis_orm/redis_orm.rb", "lib/redis_orm/utils.rb", "redis_orm.gemspec", "spec/generators/model_generator_spec.rb", "spec/spec_helper.rb", "test/association_indices_test.rb", "test/associations_test.rb", "test/atomicity_test.rb", "test/basic_functionality_test.rb", "test/callbacks_test.rb", "test/changes_array_test.rb", "test/classes/album.rb", "test/classes/article.rb", "test/classes/article_with_comments.rb", "test/classes/book.rb", "test/classes/catalog_item.rb", "test/classes/category.rb", "test/classes/city.rb", "test/classes/comment.rb", "test/classes/country.rb", "test/classes/custom_user.rb", "test/classes/cutout.rb", "test/classes/cutout_aggregator.rb", "test/classes/default_user.rb", "test/classes/dynamic_finder_user.rb", "test/classes/empty_person.rb", "test/classes/expire_user.rb", "test/classes/expire_user_with_predicate.rb", "test/classes/giftcard.rb", "test/classes/jigsaw.rb", "test/classes/location.rb", "test/classes/message.rb", "test/classes/note.rb", "test/classes/omni_user.rb", "test/classes/person.rb", "test/classes/photo.rb", "test/classes/profile.rb", "test/classes/sortable_user.rb", "test/classes/timestamp.rb", "test/classes/user.rb", "test/classes/uuid_default_user.rb", "test/classes/uuid_timestamp.rb", "test/classes/uuid_user.rb", "test/dynamic_finders_test.rb", "test/exceptions_test.rb", "test/expire_records_test.rb", "test/has_one_has_many_test.rb", "test/indices_test.rb", "test/modules/belongs_to_model_within_module.rb", "test/modules/has_many_model_within_module.rb", "test/options_test.rb", "test/polymorphic_test.rb", "test/redis.conf", "test/sortable_test.rb", "test/test_helper.rb", "test/uuid_as_id_test.rb", "test/validations_test.rb"]
14
+ s.homepage = "https://github.com/german/redis_orm"
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Redis_orm", "--main", "README.md"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = "redis_orm"
18
+ s.rubygems_version = "1.8.25"
19
+ s.summary = "ORM for Redis (advanced key-value storage) with ActiveRecord API"
20
+ s.test_files = ["test/association_indices_test.rb", "test/associations_test.rb", "test/atomicity_test.rb", "test/basic_functionality_test.rb", "test/callbacks_test.rb", "test/changes_array_test.rb", "test/dynamic_finders_test.rb", "test/exceptions_test.rb", "test/expire_records_test.rb", "test/has_one_has_many_test.rb", "test/indices_test.rb", "test/options_test.rb", "test/polymorphic_test.rb", "test/sortable_test.rb", "test/test_helper.rb", "test/uuid_as_id_test.rb", "test/validations_test.rb"]
21
21
 
22
22
  if s.respond_to? :specification_version then
23
23
  s.specification_version = 3
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ require 'rails/generators/redis_orm/model/model_generator'
4
+
5
+ describe RedisOrm::Generators::ModelGenerator do
6
+ destination File.expand_path(File.join(File.dirname(__FILE__),
7
+ '..', '..', 'tmp'))
8
+
9
+ before do
10
+ prepare_destination
11
+ run_generator args
12
+ end
13
+ subject { file('app/models/post.rb') }
14
+
15
+ context "Given only model's name" do
16
+ let(:args) { %w[post] }
17
+
18
+ it { should exist }
19
+ end
20
+ context "Given model's name and attributes" do
21
+ let(:args) { %w[post title:string created_at:time] }
22
+
23
+ it { should exist }
24
+ it "should define properties" do
25
+ should contain /property\s+\:title,\sString/
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,17 @@
1
+ require 'rails/all'
2
+ require 'rspec'
3
+ require 'rspec/autorun'
4
+
5
+ $: << File.dirname(File.expand_path(__FILE__)) + '/../lib/'
6
+
7
+ module RedisOrmRails
8
+ class Application < ::Rails::Application
9
+ end
10
+ end
11
+
12
+ require 'rspec/rails'
13
+ require 'ammeter/init'
14
+
15
+ RSpec.configure do |config|
16
+ config.mock_with :rspec
17
+ end
@@ -14,16 +14,18 @@ describe "check basic functionality" do
14
14
  user.name = "Anderson"
15
15
  User.first.should_not == user
16
16
  end
17
-
17
+
18
18
  it "test_simple_creation" do
19
19
  User.count.should == 0
20
20
 
21
21
  user = User.new :name => "german"
22
+
22
23
  user.save
23
24
 
24
25
  user.should be
25
26
 
26
27
  user.name.should == "german"
28
+ user.__redis_record_key.should == "user:1"
27
29
 
28
30
  User.count.should == 1
29
31
  User.first.name.should == "german"
@@ -109,8 +111,8 @@ describe "check basic functionality" do
109
111
 
110
112
  u = User.first
111
113
 
112
- u.created_at.class.should == Time
113
- u.modified_at.class.should == Time
114
+ u.created_at.class.should == DateTime
115
+ u.modified_at.class.should == DateTime
114
116
  u.wage.class.should == Float
115
117
  u.male.class.to_s.should match(/TrueClass|FalseClass/)
116
118
  u.age.class.to_s.should match(/Integer|Fixnum/)
@@ -128,8 +130,8 @@ describe "check basic functionality" do
128
130
 
129
131
  u = DefaultUser.first
130
132
 
131
- u.created_at.class.should == Time
132
- u.modified_at.class.should == Time
133
+ u.created_at.class.should == DateTime
134
+ u.modified_at.class.should == DateTime
133
135
  u.wage.class.should == Float
134
136
  u.male.class.to_s.should match(/TrueClass|FalseClass/)
135
137
  u.admin.class.to_s.should match(/TrueClass|FalseClass/)
@@ -149,17 +151,46 @@ describe "check basic functionality" do
149
151
  du_saved.name.should == "germaninthetown"
150
152
  du_saved.admin.should == false
151
153
  end
152
-
154
+
153
155
  it "should expand timestamps declaration properly" do
154
156
  t = TimeStamp.new
155
157
  t.save
156
-
157
158
  t.created_at.should be
158
159
  t.modified_at.should be
159
160
  t.created_at.day.should == Time.now.day
160
161
  t.modified_at.day.should == Time.now.day
161
162
  end
162
163
 
164
+ it "should store arrays in the property correctly" do
165
+ a = ArticleWithComments.new :title => "Article #1", :comments => ["Hello", "there are comments"]
166
+ expect {
167
+ a.save
168
+ }.to change(ArticleWithComments, :count).by(1)
169
+
170
+ saved_article = ArticleWithComments.last
171
+ saved_article.comments.should == ["Hello", "there are comments"]
172
+ end
173
+
174
+ it "should store default hash in the property if it's not provided" do
175
+ a = ArticleWithComments.new :title => "Article #1"
176
+ expect {
177
+ a.save
178
+ }.to change(ArticleWithComments, :count).by(1)
179
+
180
+ saved_article = ArticleWithComments.last
181
+ saved_article.rates.should == {1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0}
182
+ end
183
+
184
+ it "should store hash in the property correctly" do
185
+ a = ArticleWithComments.new :title => "Article #1", :rates => {4 => 134}
186
+ expect {
187
+ a.save
188
+ }.to change(ArticleWithComments, :count).by(1)
189
+
190
+ saved_article = ArticleWithComments.last
191
+ saved_article.rates.should == {4 => 134}
192
+ end
193
+
163
194
  it "should properly transform :default values to right classes (if :default values are wrong) so when comparing them to other/stored instances they'll be the same" do
164
195
  # SortableUser class has 3 properties with wrong classes of :default value
165
196
  u = SortableUser.new :name => "Alan"
@@ -170,4 +201,4 @@ describe "check basic functionality" do
170
201
  su.wage.should == 20_000.0
171
202
  su.age.should == 26
172
203
  end
173
- end
204
+ end
@@ -0,0 +1,8 @@
1
+ class ArticleWithComments < RedisOrm::Base
2
+ property :title, String
3
+ property :comments, Array
4
+
5
+ property :rates, Hash, :default => {1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0}
6
+
7
+ has_many :categories
8
+ end
@@ -0,0 +1,8 @@
1
+ class ExpireUser < RedisOrm::Base
2
+ property :name, String
3
+
4
+ expire 10.minutes.from_now
5
+
6
+ has_many :articles
7
+ has_one :profile
8
+ end
@@ -0,0 +1,13 @@
1
+ class ExpireUserWithPredicate < RedisOrm::Base
2
+ property :name, String
3
+ property :persist, RedisOrm::Boolean, :default => false
4
+
5
+ expire 10.minutes.from_now, :if => Proc.new {|r| !r.persist?}
6
+
7
+ has_many :articles
8
+ has_one :profile
9
+
10
+ def persist?
11
+ !!self.persist
12
+ end
13
+ end
@@ -3,6 +3,7 @@ class Profile < RedisOrm::Base
3
3
  property :name, String
4
4
 
5
5
  belongs_to :user
6
+ belongs_to :expire_user
6
7
  has_one :location
7
8
  has_one :city
8
9
  end
@@ -32,4 +32,16 @@ describe "exceptions test" do
32
32
  jigsaw = Jigsaw.create :title => "jigsaw"
33
33
  lambda { User.create!(:name => "John", :age => 44, :profile => jigsaw) }.should raise_error(RedisOrm::TypeMismatchError)
34
34
  end
35
+
36
+ it "should throw an exception if wrong format of the default value is specified for Array/Hash property" do
37
+ a = ArticleWithComments.new :title => "Article #1", :rates => [1,2,3,4,5]
38
+ lambda {
39
+ a.save
40
+ }.should raise_error(RedisOrm::TypeMismatchError)
41
+
42
+ a = ArticleWithComments.new :title => "Article #1", :comments => 12
43
+ lambda {
44
+ a.save
45
+ }.should raise_error(RedisOrm::TypeMismatchError)
46
+ end
35
47
  end
@@ -0,0 +1,64 @@
1
+ require File.dirname(File.expand_path(__FILE__)) + '/test_helper.rb'
2
+
3
+ describe "expire record after specified time" do
4
+ it "should create a record and then delete if *expire* method is specified in appropriate class" do
5
+ euser = ExpireUser.create :name => "Ghost rider"
6
+ $redis.ttl(euser.__redis_record_key).should be > 9.minutes.from_now.to_i
7
+ $redis.ttl(euser.__redis_record_key).should be < (10.minutes.from_now.to_i + 1)
8
+ end
9
+
10
+ it "should create a record and then delete if *expire* method is specified in appropriate class" do
11
+ euser = ExpireUserWithPredicate.create :name => "Ghost rider"
12
+ $redis.ttl(euser.__redis_record_key).should be > 9.minutes.from_now.to_i
13
+ $redis.ttl(euser.__redis_record_key).should be < (10.minutes.from_now.to_i + 1)
14
+
15
+ euser2 = ExpireUserWithPredicate.create :name => "Ghost rider", :persist => true
16
+ $redis.ttl(euser2.__redis_record_key).should == -1
17
+ end
18
+
19
+ it "should create a record with an inline *expire* option (which overrides default *expire* value)" do
20
+ euser = ExpireUser.create :name => "Ghost rider", :expire_in => 50.minutes.from_now
21
+ $redis.ttl(euser.__redis_record_key).should be < (50.minutes.from_now.to_i + 1)
22
+ $redis.ttl(euser.__redis_record_key).should be > 49.minutes.from_now.to_i
23
+ end
24
+
25
+ it "should also create expirable key when record has associated records" do
26
+ euser = ExpireUser.create :name => "Ghost rider"
27
+ $redis.ttl(euser.__redis_record_key).should be > 9.minutes.from_now.to_i
28
+ $redis.ttl(euser.__redis_record_key).should be < (10.minutes.from_now.to_i + 1)
29
+
30
+ profile = Profile.create :title => "Profile for ghost rider", :name => "Ghost Rider"
31
+ articles = [Article.create(:title => "article1", :karma => 1), Article.create(:title => "article2", :karma => 2)]
32
+
33
+ euser.profile = profile
34
+ euser.profile.should == profile
35
+ $redis.get("expire_user:1:profile").to_i.should == profile.id
36
+ $redis.ttl("expire_user:1:profile").should be > 9.minutes.from_now.to_i
37
+ $redis.ttl("expire_user:1:profile").should be < (10.minutes.from_now.to_i + 1)
38
+
39
+ euser.articles = articles
40
+ $redis.zrange("expire_user:1:articles", 0, -1).should =~ articles.map{|a| a.id.to_s}
41
+ $redis.ttl("expire_user:1:articles").should be > 9.minutes.from_now.to_i
42
+ $redis.ttl("expire_user:1:articles").should be < (10.minutes.from_now.to_i + 1)
43
+ end
44
+
45
+ it "should also create expirable key when record has associated records (class with predicate expiry)" do
46
+ euser2 = ExpireUserWithPredicate.create :name => "Ghost rider", :persist => false
47
+ $redis.ttl(euser2.__redis_record_key).should be > 9.minutes.from_now.to_i
48
+ $redis.ttl(euser2.__redis_record_key).should be < (10.minutes.from_now.to_i + 1)
49
+
50
+ profile = Profile.create :title => "Profile for ghost rider", :name => "Ghost Rider"
51
+ articles = [Article.create(:title => "article1", :karma => 1), Article.create(:title => "article2", :karma => 2)]
52
+
53
+ euser2.profile = profile
54
+ euser2.profile.should == profile
55
+ $redis.get("expire_user_with_predicate:1:profile").to_i.should == profile.id
56
+ $redis.ttl("expire_user_with_predicate:1:profile").should be > 9.minutes.from_now.to_i
57
+ $redis.ttl("expire_user_with_predicate:1:profile").should be < (10.minutes.from_now.to_i + 1)
58
+
59
+ euser2.articles << articles
60
+ $redis.zrange("expire_user_with_predicate:1:articles", 0, -1).should =~ articles.map{|a| a.id.to_s}
61
+ $redis.ttl("expire_user_with_predicate:1:articles").should be > 9.minutes.from_now.to_i
62
+ $redis.ttl("expire_user_with_predicate:1:articles").should be < (10.minutes.from_now.to_i + 1)
63
+ end
64
+ end
@@ -81,7 +81,7 @@ describe "test options" do
81
81
  Photo.last(:conditions => {:image => "facepalm.jpg", :image_type => "jpg"}).should == @photo1
82
82
  Photo.last(:conditions => {:image => "boobs.png", :image_type => "png"}).should == @photo2
83
83
  end
84
-
84
+
85
85
  it "should correctly save boolean values" do
86
86
  $redis.hgetall("photo:#{@photo1.id}")["inverted"].should == "true"
87
87
  $redis.hgetall("photo:#{@photo2.id}")["inverted"].should == "false"
@@ -223,4 +223,4 @@ describe "test options" do
223
223
  @album.photos.count.should == 1
224
224
  @album.photos.size.should == 1
225
225
  end
226
- end
226
+ end
@@ -303,7 +303,7 @@ no-appendfsync-on-rewrite no
303
303
  # To enable VM just set 'vm-enabled' to yes, and set the following three
304
304
  # VM parameters accordingly to your needs.
305
305
 
306
- vm-enabled no
306
+ #vm-enabled no
307
307
  # vm-enabled yes
308
308
 
309
309
  # This is the path of the Redis swap file. As you can guess, swap files
@@ -317,7 +317,7 @@ vm-enabled no
317
317
  # *** WARNING *** if you are using a shared hosting the default of putting
318
318
  # the swap file under /tmp is not secure. Create a dir with access granted
319
319
  # only to Redis user and configure Redis to create the swap file there.
320
- vm-swap-file /tmp/redis.swap
320
+ #vm-swap-file /tmp/redis.swap
321
321
 
322
322
  # vm-max-memory configures the VM to use at max the specified amount of
323
323
  # RAM. Everything that deos not fit will be swapped on disk *if* possible, that
@@ -327,7 +327,7 @@ vm-swap-file /tmp/redis.swap
327
327
  # default, just specify the max amount of RAM you can in bytes, but it's
328
328
  # better to leave some margin. For instance specify an amount of RAM
329
329
  # that's more or less between 60 and 80% of your free RAM.
330
- vm-max-memory 0
330
+ #vm-max-memory 0
331
331
 
332
332
  # Redis swap files is split into pages. An object can be saved using multiple
333
333
  # contiguous pages, but pages can't be shared between different objects.
@@ -338,7 +338,7 @@ vm-max-memory 0
338
338
  # If you use a lot of small objects, use a page size of 64 or 32 bytes.
339
339
  # If you use a lot of big objects, use a bigger page size.
340
340
  # If unsure, use the default :)
341
- vm-page-size 32
341
+ #vm-page-size 32
342
342
 
343
343
  # Number of total memory pages in the swap file.
344
344
  # Given that the page table (a bitmap of free/used pages) is taken in memory,
@@ -351,7 +351,7 @@ vm-page-size 32
351
351
  #
352
352
  # It's better to use the smallest acceptable value for your application,
353
353
  # but the default is large in order to work in most conditions.
354
- vm-pages 134217728
354
+ #vm-pages 134217728
355
355
 
356
356
  # Max number of VM I/O threads running at the same time.
357
357
  # This threads are used to read/write data from/to swap file, since they
@@ -362,7 +362,7 @@ vm-pages 134217728
362
362
  #
363
363
  # The special value of 0 turn off threaded I/O and enables the blocking
364
364
  # Virtual Memory implementation.
365
- vm-max-threads 4
365
+ #vm-max-threads 4
366
366
 
367
367
  ############################### ADVANCED CONFIG ###############################
368
368
 
@@ -370,8 +370,8 @@ vm-max-threads 4
370
370
  # have at max a given numer of elements, and the biggest element does not
371
371
  # exceed a given threshold. You can configure this limits with the following
372
372
  # configuration directives.
373
- hash-max-zipmap-entries 512
374
- hash-max-zipmap-value 64
373
+ #hash-max-zipmap-entries 512
374
+ #hash-max-zipmap-value 64
375
375
 
376
376
  # Similarly to hashes, small lists are also encoded in a special way in order
377
377
  # to save a lot of space. The special representation is only used when
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'rspec'
2
4
  require 'rspec/autorun'
3
5
  require File.dirname(File.expand_path(__FILE__)) + '/../lib/redis_orm.rb'
@@ -6,6 +8,7 @@ Dir.glob(['test/classes/*.rb', 'test/modules/*.rb']).each do |klassfile|
6
8
  require File.dirname(File.expand_path(__FILE__)) + '/../' + klassfile
7
9
  end
8
10
 
11
+
9
12
  RSpec.configure do |config|
10
13
  config.before(:all) do
11
14
  path_to_conf = File.dirname(File.expand_path(__FILE__)) + "/redis.conf"
@@ -105,8 +105,8 @@ describe "check basic functionality" do
105
105
 
106
106
  u = UuidUser.first
107
107
 
108
- u.created_at.class.should == Time
109
- u.modified_at.class.should == Time
108
+ u.created_at.class.should == DateTime
109
+ u.modified_at.class.should == DateTime
110
110
  u.wage.class.should == Float
111
111
  u.male.class.to_s.should match(/TrueClass|FalseClass/)
112
112
  u.age.class.to_s.should match(/Integer|Fixnum/)
@@ -126,8 +126,8 @@ describe "check basic functionality" do
126
126
 
127
127
  u = UuidDefaultUser.first
128
128
 
129
- u.created_at.class.should == Time
130
- u.modified_at.class.should == Time
129
+ u.created_at.class.should == DateTime
130
+ u.modified_at.class.should == DateTime
131
131
  u.wage.class.should == Float
132
132
  u.male.class.to_s.should match(/TrueClass|FalseClass/)
133
133
  u.admin.class.to_s.should match(/TrueClass|FalseClass/)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_orm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: '0.7'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-23 00:00:00.000000000Z
12
+ date: 2013-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &11707440 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *11707440
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: activemodel
27
- requirement: &11706780 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 3.0.0
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *11706780
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 3.0.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: redis
38
- requirement: &11706160 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 2.2.0
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *11706160
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.2.0
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: uuid
49
- requirement: &11705440 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 2.3.2
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *11705440
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 2.3.2
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rspec
60
- requirement: &11704820 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,7 +85,12 @@ dependencies:
65
85
  version: 2.5.0
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *11704820
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 2.5.0
69
94
  description: ORM for Redis (advanced key-value storage) with ActiveRecord API
70
95
  email: germaninthetown@gmail.com
71
96
  executables: []
@@ -75,6 +100,8 @@ extra_rdoc_files:
75
100
  - LICENSE
76
101
  - README.md
77
102
  - TODO
103
+ - lib/rails/generators/redis_orm/model/model_generator.rb
104
+ - lib/rails/generators/redis_orm/model/templates/model.rb.erb
78
105
  - lib/redis_orm.rb
79
106
  - lib/redis_orm/active_model_behavior.rb
80
107
  - lib/redis_orm/associations/belongs_to.rb
@@ -93,6 +120,8 @@ files:
93
120
  - Rakefile
94
121
  - TODO
95
122
  - benchmarks/sortable_benchmark.rb
123
+ - lib/rails/generators/redis_orm/model/model_generator.rb
124
+ - lib/rails/generators/redis_orm/model/templates/model.rb.erb
96
125
  - lib/redis_orm.rb
97
126
  - lib/redis_orm/active_model_behavior.rb
98
127
  - lib/redis_orm/associations/belongs_to.rb
@@ -103,6 +132,8 @@ files:
103
132
  - lib/redis_orm/redis_orm.rb
104
133
  - lib/redis_orm/utils.rb
105
134
  - redis_orm.gemspec
135
+ - spec/generators/model_generator_spec.rb
136
+ - spec/spec_helper.rb
106
137
  - test/association_indices_test.rb
107
138
  - test/associations_test.rb
108
139
  - test/atomicity_test.rb
@@ -111,6 +142,7 @@ files:
111
142
  - test/changes_array_test.rb
112
143
  - test/classes/album.rb
113
144
  - test/classes/article.rb
145
+ - test/classes/article_with_comments.rb
114
146
  - test/classes/book.rb
115
147
  - test/classes/catalog_item.rb
116
148
  - test/classes/category.rb
@@ -123,6 +155,8 @@ files:
123
155
  - test/classes/default_user.rb
124
156
  - test/classes/dynamic_finder_user.rb
125
157
  - test/classes/empty_person.rb
158
+ - test/classes/expire_user.rb
159
+ - test/classes/expire_user_with_predicate.rb
126
160
  - test/classes/giftcard.rb
127
161
  - test/classes/jigsaw.rb
128
162
  - test/classes/location.rb
@@ -140,6 +174,7 @@ files:
140
174
  - test/classes/uuid_user.rb
141
175
  - test/dynamic_finders_test.rb
142
176
  - test/exceptions_test.rb
177
+ - test/expire_records_test.rb
143
178
  - test/has_one_has_many_test.rb
144
179
  - test/indices_test.rb
145
180
  - test/modules/belongs_to_model_within_module.rb
@@ -177,24 +212,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
212
  version: '1.2'
178
213
  requirements: []
179
214
  rubyforge_project: redis_orm
180
- rubygems_version: 1.8.6
215
+ rubygems_version: 1.8.25
181
216
  signing_key:
182
217
  specification_version: 3
183
218
  summary: ORM for Redis (advanced key-value storage) with ActiveRecord API
184
219
  test_files:
220
+ - test/association_indices_test.rb
221
+ - test/associations_test.rb
185
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
186
230
  - test/indices_test.rb
231
+ - test/options_test.rb
232
+ - test/polymorphic_test.rb
187
233
  - test/sortable_test.rb
188
- - test/uuid_as_id_test.rb
189
234
  - test/test_helper.rb
190
- - test/options_test.rb
191
- - test/callbacks_test.rb
192
- - test/exceptions_test.rb
193
- - test/associations_test.rb
235
+ - test/uuid_as_id_test.rb
194
236
  - test/validations_test.rb
195
- - test/basic_functionality_test.rb
196
- - test/dynamic_finders_test.rb
197
- - test/changes_array_test.rb
198
- - test/polymorphic_test.rb
199
- - test/association_indices_test.rb
200
- - test/has_one_has_many_test.rb