redis-orm 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ *.rbc
1
2
  *.gem
2
3
  .bundle
3
4
  Gemfile.lock
@@ -0,0 +1,8 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - ree
6
+ - jruby
7
+ - ruby-head
8
+ - rbx-2.0
data/README.md CHANGED
@@ -28,7 +28,7 @@ Inherit from `Redis::ORM` as if you were inheriting from `ActiveRecord::Base`:
28
28
  # more code here!
29
29
  end
30
30
 
31
- At this point your Accounts can be created, saved, and so forth. It might be helpful to define attributes on the model, however, or else the model will be quite useless indeed!
31
+ At this point your Users can be created, saved, and so forth. It might be helpful to define attributes on the model, however, or else the model will be quite useless indeed!
32
32
 
33
33
  ### attributes
34
34
 
@@ -67,7 +67,7 @@ There are 3 core relationships defined by `redis-orm`: `belongs_to`, `has_one` a
67
67
  belongs_to :user
68
68
  end
69
69
 
70
- As shwon above, you should usually follow your `has_one` and `has_many` directives with a `relation` option, which matches the corresponding `belongs_to` relation in the other models. Think of it as the `foreign_key` option in ActiveRecord. This option is not strictly required and `redis-orm` will work fine without it, but you may have problems looking up the reverse relations (e.g. the `belongs_to` part) without it.
70
+ As shown above, you should usually follow your `has_one` and `has_many` directives with a `relation` option, which matches the corresponding `belongs_to` relation in the other models. Think of it as the `foreign_key` option in ActiveRecord. This option is not strictly required and `redis-orm` will work fine without it, but you may have problems looking up the reverse relations (e.g. the `belongs_to` part) without it.
71
71
 
72
72
  Alternatively, you can specify a `relation` option for the `belongs_to` directive, instead:
73
73
 
data/Rakefile CHANGED
@@ -1 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Default: run specs.'
6
+ task :default => :spec
7
+
8
+ desc "Run specs"
9
+ RSpec::Core::RakeTask.new
@@ -35,7 +35,9 @@ module Redis::Actions::Saving
35
35
  end
36
36
 
37
37
  def define_id
38
- self.id = File.join(model_name, connection.incr("__uniq__").to_s)
38
+ # model_name.to_s is required because model_name is actually an ActiveModel::Name
39
+ # and that can't be serialized by Rubinius. (Worked fine with all other rubies, though...)
40
+ self.id = File.join(model_name.to_s, connection.incr("__uniq__").to_s)
39
41
  end
40
42
 
41
43
  module ClassMethods
@@ -3,7 +3,7 @@ class Redis
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 0
6
- PATCH = 3
6
+ PATCH = 4
7
7
  PREREL = nil
8
8
 
9
9
  STRING = PREREL ? [MAJOR, MINOR, PATCH, PREREL].join('.') : [MAJOR, MINOR, PATCH].join('.')
@@ -19,6 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_development_dependency 'rspec', '~> 2.6.0'
22
+ s.add_development_dependency 'rake', '~> 0.9.2'
23
+ s.add_development_dependency 'bundler', '~> 1.0.18'
22
24
 
23
25
  s.add_runtime_dependency 'redis', '~> 2.2.2'
24
26
  s.add_runtime_dependency 'activemodel', '~> 3.0.10'
@@ -13,6 +13,10 @@ describe Redis::Actions::Finding do
13
13
  it "should find all of them" do
14
14
  all = orm_class.all
15
15
  all.length.should == 10
16
+
17
+ # we must sort due to hashes being unordered in Ruby 1.8
18
+ all = all.sort { |a, b| a.random <=> b.random }
19
+
16
20
  10.times { |i| all[i].random.should == i }
17
21
  end
18
22
  end
data/test.rb CHANGED
@@ -15,8 +15,8 @@ a2.save!
15
15
  a1.others << a2 << a3
16
16
  a1.save!
17
17
 
18
- p a1.key
19
- p A.find(a1.key), A.find(a1.key).others
18
+ p a1.id
19
+ p A.find(a1.id), A.find(a1.id).others
20
20
 
21
21
  puts A.all.collect { |a| a.inspect }
22
22
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: redis-orm
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Colin MacKenzie IV
@@ -24,27 +24,49 @@ dependencies:
24
24
  type: :development
25
25
  version_requirements: *id001
26
26
  - !ruby/object:Gem::Dependency
27
- name: redis
27
+ name: rake
28
28
  prerelease: false
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.9.2
35
+ type: :development
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.18
46
+ type: :development
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: redis
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
30
52
  none: false
31
53
  requirements:
32
54
  - - ~>
33
55
  - !ruby/object:Gem::Version
34
56
  version: 2.2.2
35
57
  type: :runtime
36
- version_requirements: *id002
58
+ version_requirements: *id004
37
59
  - !ruby/object:Gem::Dependency
38
60
  name: activemodel
39
61
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
41
63
  none: false
42
64
  requirements:
43
65
  - - ~>
44
66
  - !ruby/object:Gem::Version
45
67
  version: 3.0.10
46
68
  type: :runtime
47
- version_requirements: *id003
69
+ version_requirements: *id005
48
70
  description: The goal of this project is to provide ORM for Redis that feels very similar to ActiveRecord.
49
71
  email:
50
72
  - sinisterchipmunk@gmail.com
@@ -56,6 +78,7 @@ extra_rdoc_files: []
56
78
 
57
79
  files:
58
80
  - .gitignore
81
+ - .travis.yml
59
82
  - Gemfile
60
83
  - README.md
61
84
  - Rakefile