redis_storage 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -22,6 +22,12 @@ Roadmap aka. ToDo
22
22
  * perhaps some kind of dirty flag - or the ActiveModel::Dirty module, but that will make some things way more complicated
23
23
  * more tests/specs are always good
24
24
 
25
+ Newest Stuff
26
+ ---
27
+
28
+ * the generator now calls the test_framework generator for models
29
+ * added a random method which returns a random item from the collection
30
+
25
31
  Installation
26
32
  ---
27
33
 
@@ -12,6 +12,7 @@ module Rails
12
12
  def create_model_file
13
13
  template 'model.rb', File.join('app/models',class_path,"#{file_name}.rb")
14
14
  end
15
+ hook_for :test_framework, :as=> :model
15
16
  end
16
17
  end
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module RedisStorage
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/redis_storage.rb CHANGED
@@ -29,9 +29,16 @@ module RedisStorage
29
29
  obj
30
30
  end
31
31
 
32
+ def self.random
33
+ i = $db.srandmember("#{db_key}:persisted")
34
+ find_by_id(i) unless i.nil?
35
+ end
32
36
  def self.find(params=nil)
33
- return find_by_id(params) unless params.nil? #TODO perhaps make this at some point more generic
34
- return all
37
+ if params.nil?
38
+ all
39
+ else
40
+ find_by_id(params) #TODO perhaps make this at some point more generic
41
+ end
35
42
  end
36
43
  def self.find_by_id(entry_id)
37
44
  r = $db.get("#{db_key}:#{entry_id}")
metadata CHANGED
@@ -1,150 +1,112 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: redis_storage
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 4
10
- version: 0.2.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Andreas Eger
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-06-25 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-06-26 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: redis
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &44131200 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: json
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *44131200
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ requirement: &44130780 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
46
33
  type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: activemodel
50
34
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *44130780
36
+ - !ruby/object:Gem::Dependency
37
+ name: activemodel
38
+ requirement: &44130280 !ruby/object:Gem::Requirement
52
39
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 7
57
- segments:
58
- - 3
59
- - 0
60
- - 0
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
61
43
  version: 3.0.0
62
44
  type: :runtime
63
- version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
65
- name: rspec
66
45
  prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *44130280
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &44129780 !ruby/object:Gem::Requirement
68
50
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 15
73
- segments:
74
- - 2
75
- - 0
76
- - 0
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
77
54
  version: 2.0.0
78
55
  type: :development
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: mocha
82
56
  prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *44129780
58
+ - !ruby/object:Gem::Dependency
59
+ name: mocha
60
+ requirement: &44129400 !ruby/object:Gem::Requirement
84
61
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
92
66
  type: :development
93
- version_requirements: *id005
94
- - !ruby/object:Gem::Dependency
95
- name: autotest
96
67
  prerelease: false
97
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *44129400
69
+ - !ruby/object:Gem::Dependency
70
+ name: autotest
71
+ requirement: &44128940 !ruby/object:Gem::Requirement
98
72
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
106
77
  type: :development
107
- version_requirements: *id006
108
- - !ruby/object:Gem::Dependency
109
- name: redis
110
78
  prerelease: false
111
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *44128940
80
+ - !ruby/object:Gem::Dependency
81
+ name: redis
82
+ requirement: &44128520 !ruby/object:Gem::Requirement
112
83
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
118
- - 0
119
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
120
88
  type: :development
121
- version_requirements: *id007
122
- - !ruby/object:Gem::Dependency
123
- name: rails
124
89
  prerelease: false
125
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *44128520
91
+ - !ruby/object:Gem::Dependency
92
+ name: rails
93
+ requirement: &44128020 !ruby/object:Gem::Requirement
126
94
  none: false
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- hash: 7
131
- segments:
132
- - 3
133
- - 0
134
- - 0
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
135
98
  version: 3.0.0
136
99
  type: :development
137
- version_requirements: *id008
138
- description: Provides a databackend for a Redis in Rails, will also provide a Rails 3 Generator
139
- email:
100
+ prerelease: false
101
+ version_requirements: *44128020
102
+ description: Provides a databackend for a Redis in Rails, will also provide a Rails
103
+ 3 Generator
104
+ email:
140
105
  - dev@eger-andreas.de
141
106
  executables: []
142
-
143
107
  extensions: []
144
-
145
108
  extra_rdoc_files: []
146
-
147
- files:
109
+ files:
148
110
  - .gitignore
149
111
  - .rspec
150
112
  - .rvmrc
@@ -163,36 +125,26 @@ files:
163
125
  - test/generator_test.rb
164
126
  homepage: https://github.com/sch1zo/redis_storage
165
127
  licenses: []
166
-
167
128
  post_install_message:
168
129
  rdoc_options: []
169
-
170
- require_paths:
130
+ require_paths:
171
131
  - lib
172
- required_ruby_version: !ruby/object:Gem::Requirement
132
+ required_ruby_version: !ruby/object:Gem::Requirement
173
133
  none: false
174
- requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- hash: 3
178
- segments:
179
- - 0
180
- version: "0"
181
- required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ! '>='
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
139
  none: false
183
- requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- hash: 3
187
- segments:
188
- - 0
189
- version: "0"
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
190
144
  requirements: []
191
-
192
145
  rubyforge_project: redis_storage
193
146
  rubygems_version: 1.8.5
194
147
  signing_key:
195
148
  specification_version: 3
196
149
  summary: A simple Redis ORM for Rails
197
150
  test_files: []
198
-