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 CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{leanback}
8
- s.version = "0.2.3"
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-19}
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 = [
@@ -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
- view = { :database => db_name, :design_doc => design_doc_name, :view => view_name}
214
- docs = find view,search_term
215
-
216
- #add a finder/index if one doesn't already exist in the database
217
- #then find_by_key
218
- if(docs.is_a?(Hash))#when finder doesn't exist docs returns {"error"=>"not_found", "reason"=>"missing"}
219
- if (docs.keys[0].to_s == "error") && (docs.values[0].to_s == "not_found") && (docs.keys[1].to_s == "reason")
220
- add_finder(:database => db_name, :key => index)
221
- docs = find view,search_term
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
 
@@ -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
- #docs = Couchdb.find_by( :database => 'contacts', :lastname => 'Smith')
49
- #docs = Couchdb.find_by( :database => 'contacts', :gender => 'female')
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
- puts "Error message: " + e.to_s
73
- puts "Error value: " + e.error
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
- #puts 'docs = Couchdb.docs_from monitors'
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
- - 3
9
- version: 0.2.3
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-19 00:00:00 -04:00
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: 143649905
139
+ hash: 600156783
140
140
  segments:
141
141
  - 0
142
142
  version: "0"