public
Description: Library to access couchdb in ruby
Homepage: http://couchobject.rubyforge.org
Clone URL: git://github.com/halfbyte/couchobject.git
- renamed view requestor
- Updated README, History and Hoe dependency
- Upped the version
js (author)
Fri Sep 14 16:07:11 -0700 2007
commit  c0b443a55a91e0e7f9caf1bd585a4e0306b83da4
tree    d0306d962aeb55bf61d6e68c0c47b67398e2ee03
parent  ae74f5c961866f86c7ac89278952835c54e14f9d
...
1
 
 
 
 
 
 
 
 
 
 
 
2
3
4
...
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0
@@ -1,4 +1,14 @@
0
-== 0.0.1 2007-09-05
0
+== 0.0.2 2007-09-15
0
+
0
+* 1 major enhancement:
0
+ * Database.filter{|doc| } for filtering the on doc, in Ruby!
0
+ * couch_view_requestor, a JsServer client for CouchDb allowing you to query in Ruby
0
+
0
+* 1 minor enhancement:
0
+ * Added Database#store(document), the parallel of Document#save(database)
0
+
0
+
0
+== 0.0.1 2007-09-13
0
 
0
 * 1 major enhancement:
0
   * Initial release
...
4
5
6
 
7
8
9
...
11
12
13
 
14
15
16
...
28
29
30
 
31
32
33
...
4
5
6
7
8
9
10
...
12
13
14
15
16
17
18
...
30
31
32
33
34
35
36
0
@@ -4,6 +4,7 @@ Manifest.txt
0
 README.txt
0
 Rakefile
0
 TODO
0
+bin/couch_view_requestor
0
 config/hoe.rb
0
 config/requirements.rb
0
 lib/couch_object.rb
0
@@ -11,6 +12,7 @@ lib/couch_object/database.rb
0
 lib/couch_object/document.rb
0
 lib/couch_object/model.rb
0
 lib/couch_object/persistable.rb
0
+lib/couch_object/proc_condition.rb
0
 lib/couch_object/response.rb
0
 lib/couch_object/server.rb
0
 lib/couch_object/utils.rb
0
@@ -28,6 +30,7 @@ spec/integration/document_integration_spec.rb
0
 spec/integration/integration_helper.rb
0
 spec/model_spec.rb
0
 spec/persistable_spec.rb
0
+spec/proc_condition_spec.rb
0
 spec/response_spec.rb
0
 spec/rspec_autotest.rb
0
 spec/server_spec.rb
...
45
46
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
49
50
...
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
0
@@ -45,6 +45,26 @@ Issueing CouchObject::Database#get, CouchObject::Database#post, CouchObject::Dat
0
   => {"_rev"=>548318611, "ok"=>true}
0
   >> db.get("_all_docs").parsed_body
0
   => {"rows"=>[], "view"=>"_all_docs"}
0
+
0
+== The Couch View Requestor
0
+
0
+couch_view_requestor is a JsServer client for CouchDb, allowing you to query documents with Ruby instead of Javascript! All you need to do is pass in a string with something that reponds to #call with one argument (the document):
0
+
0
+ >> db.post("_temp_view", "proc { |doc| doc[\"foo\"] =~ /ba/ }").parsed_body["rows"]
0
+ => [{"_rev"=>928806717, "_id"=>"28D568C5992CBD2B4711F57225A19517", "value"=>0}, {"_rev"=>-1696868121, "_id"=>"601D858DB2E298EFC4BBA92A11760D1E", "value"=>0}, {"_rev"=>-2093091288, "_id"=>"CABCEB3F2C8B70B3FE24A03FF6AB7A1E", "value"=>0}]
0
+ >> pp db.post("_temp_view", "proc { |doc| doc[\"foo\"] =~ /ba/ }").parsed_body["rows"]
0
+ [{"_rev"=>928806717, "_id"=>"28D568C5992CBD2B4711F57225A19517", "value"=>0},
0
+ {"_rev"=>-1696868121, "_id"=>"601D858DB2E298EFC4BBA92A11760D1E", "value"=>0},
0
+ {"_rev"=>-2093091288, "_id"=>"CABCEB3F2C8B70B3FE24A03FF6AB7A1E", "value"=>0}]
0
+
0
+But you can even do it in plain Ruby, as opposed to a string, with Database#filter:
0
+
0
+ >> db.filter do |doc|
0
+ ?> if doc["foo"] == "bar"
0
+ >> return doc
0
+ >> end
0
+ >> end
0
+ => [{"_rev"=>-1696868121, "_id"=>"601D858DB2E298EFC4BBA92A11760D1E", "value"=>{"_id"=>"601D858DB2E298EFC4BBA92A11760D1E", "_rev"=>-1696868121, "foo"=>"bar"}}, {"_rev"=>-2093091288, "_id"=>"CABCEB3F2C8B70B3FE24A03FF6AB7A1E", "value"=>{"_id"=>"CABCEB3F2C8B70B3FE24A03FF6AB7A1E", "_rev"=>-2093091288, "foo"=>"bar"}}]
0
     
0
 == The Document object
0
 
...
61
62
63
64
 
 
65
66
67
...
61
62
63
 
64
65
66
67
68
0
@@ -61,7 +61,8 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
0
   p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
0
   # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
0
   p.extra_deps = [
0
- ["json", ">= 1.1.1"]
0
+ [ "json", ">= 1.1.1" ],
0
+ [ "ruby2ruby", ">= 1.1.7" ],
0
   ]
0
   
0
   #p.spec_extras = {} # A hash of extra values to set in the gemspec.
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@ module CouchObject #:nodoc:
0
   module VERSION #:nodoc:
0
     MAJOR = 0
0
     MINOR = 0
0
- TINY = 1
0
+ TINY = 2
0
 
0
     STRING = [MAJOR, MINOR, TINY].join('.')
0
   end

Comments

    No one has commented yet.