leanback 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/leanback.gemspec +2 -2
- data/lib/leanback.rb +10 -12
- data/test/test_leanback.rb +9 -21
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/leanback.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{leanback}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Obi Akubue"]
|
12
|
-
s.date = %q{2011-07-
|
12
|
+
s.date = %q{2011-07-20}
|
13
13
|
s.description = %q{lightweight Ruby interface to CouchDB}
|
14
14
|
s.email = %q{obioraakubue@yahoo.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/leanback.rb
CHANGED
@@ -209,18 +209,16 @@ def self.find_by(options)
|
|
209
209
|
search_term = options.values[1]
|
210
210
|
design_doc_name = index + '_finder'
|
211
211
|
view_name = 'find_by_' + index
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
end
|
223
|
-
end #end of first if
|
212
|
+
|
213
|
+
begin
|
214
|
+
view = { :database => db_name, :design_doc => design_doc_name, :view => view_name}
|
215
|
+
docs = find view,search_term
|
216
|
+
rescue CouchdbException => e
|
217
|
+
#add a finder/index if one doesn't already exist in the database
|
218
|
+
#then find_by_key
|
219
|
+
add_finder(:database => db_name, :key => index)
|
220
|
+
docs = find view,search_term
|
221
|
+
end
|
224
222
|
return docs
|
225
223
|
end
|
226
224
|
|
data/test/test_leanback.rb
CHANGED
@@ -44,9 +44,9 @@ class TestLeanback < Test::Unit::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
should "find items by key" do
|
47
|
-
docs = Couchdb.find_by( :database => 'contacts', :email => 'nancy@mail.com')
|
48
|
-
|
49
|
-
#docs = Couchdb.find_by( :database => 'contacts', :
|
47
|
+
#docs = Couchdb.find_by( :database => 'contacts', :email => 'nancy@mail.com')
|
48
|
+
docs = Couchdb.find_by( :database => 'contacts', :lastname => 'smith')
|
49
|
+
#docs = Couchdb.find_by( :database => 'contacts', :country => 'female')
|
50
50
|
#puts docs.inspect
|
51
51
|
end
|
52
52
|
|
@@ -69,8 +69,8 @@ class TestLeanback < Test::Unit::TestCase
|
|
69
69
|
hash = Couchdb.find view
|
70
70
|
#puts hash.inspect
|
71
71
|
rescue CouchdbException => e
|
72
|
-
|
73
|
-
|
72
|
+
# puts "Error message: " + e.to_s
|
73
|
+
# puts "Error value: " + e.error
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -152,9 +152,9 @@ class TestLeanback < Test::Unit::TestCase
|
|
152
152
|
|
153
153
|
|
154
154
|
should "display all documents in the database" do
|
155
|
-
docs = Couchdb.docs_from 'monitors'
|
156
|
-
|
157
|
-
docs.each do |d|
|
155
|
+
#docs = Couchdb.docs_from 'monitors'
|
156
|
+
#puts 'docs = Couchdb.docs_from monitors'
|
157
|
+
#docs.each do |d|
|
158
158
|
# puts "_rev: " + d["_rev"]
|
159
159
|
#puts "_id: " + d["_id"]
|
160
160
|
#puts "every: " + d["every"]
|
@@ -164,21 +164,9 @@ class TestLeanback < Test::Unit::TestCase
|
|
164
164
|
#puts "contact: " + d["contact"]
|
165
165
|
#puts "via: " + d["via"]
|
166
166
|
#puts "notify_interval: " + d["notify_interval"]
|
167
|
-
end
|
167
|
+
#end
|
168
168
|
end
|
169
169
|
|
170
|
-
should "create view on the fly if it doesn't already exist" do
|
171
|
-
begin
|
172
|
-
docs = Couchdb.find(:database => "contacts", :design_doc => 'x_my_views', :view => 'get_emails')
|
173
|
-
rescue CouchdbException => e
|
174
|
-
#puts e.to_s
|
175
|
-
doc = { :database => 'contacts', :design_doc => 'x_my_views', :json_doc => '/home/obi/bin/my_views.json' }
|
176
|
-
#doc = { :database => 'contacts', :design_doc => 'my_views', :json_doc => '/path/to/my_views.json' }
|
177
|
-
Couchdb.create_design doc
|
178
|
-
docs = Couchdb.find(:database => "contacts", :design_doc => 'my_views', :view => 'get_emails')
|
179
|
-
end
|
180
|
-
#puts docs.inspect
|
181
|
-
end
|
182
170
|
|
183
171
|
|
184
172
|
should " switch to default bind address" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 4
|
9
|
+
version: 0.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Obi Akubue
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-07-
|
17
|
+
date: 2011-07-20 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -136,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
136
|
requirements:
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
hash:
|
139
|
+
hash: 600156783
|
140
140
|
segments:
|
141
141
|
- 0
|
142
142
|
version: "0"
|