diff --git a/CHANGELOG b/CHANGELOG index de57116..18c3733 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +v0.1.1. Fixing Manifest contents and adding Rails information to README. + v0.1.0. Adding rake tasks to sync and manage database functions and design documents. Also added support for list and show functions; as well as fulltext administration. v0.0.2. Fixing gemspec. diff --git a/Manifest b/Manifest index 62151c3..dc4595a 100644 --- a/Manifest +++ b/Manifest @@ -4,6 +4,7 @@ Manifest README.markdown Rakefile TODO +couch-client.gemspec lib/couch-client.rb lib/couch-client/attachment.rb lib/couch-client/attachment_list.rb @@ -15,6 +16,7 @@ lib/couch-client/database.rb lib/couch-client/design.rb lib/couch-client/document.rb lib/couch-client/hookup.rb +lib/couch-client/rake_task.rb lib/couch-client/row.rb spec/attachment_list_spec.rb spec/attachment_spec.rb @@ -25,9 +27,19 @@ spec/consistent_hash_spec.rb spec/couch-client_spec.rb spec/database_spec.rb spec/design_spec.rb +spec/designs/create/people/fulltext/by_name/index.js +spec/designs/create/people/validate_on_update.js +spec/designs/create/people/views/all/map.js +spec/designs/create/people/views/sum/map.js +spec/designs/create/people/views/sum/reduce.js +spec/designs/update/people/fulltext/by_name/index.js +spec/designs/update/people/validate_on_update.js +spec/designs/update/people/views/sum/map.js +spec/designs/update/people/views/sum/reduce.js spec/document_spec.rb spec/files/image.png spec/files/plain.txt spec/hookup_spec.rb +spec/rake_task_spec.rb spec/row_spec.rb spec/spec_helper.rb diff --git a/README.markdown b/README.markdown index 526f1cf..a0c2b28 100644 --- a/README.markdown +++ b/README.markdown @@ -179,6 +179,17 @@ CouchClient rake tasks can be enabled by adding the following to your `Rakefile` c.design_path = "./designs" end +Or you can add CouchClient rake tasks to your rails app by making the following file in `lib/tasks/couch.rake`. + + require "#{Rails.root}/config/environment" + + CouchClient::RakeTask.new do |c| + c.connection = Couch + c.design_path = "./app/designs" + end + +You can then specify your CouchClient settings for each each environment in their respective configuration files (e.g. development.rb, test.rb and production.rb). + Two parameters are available, `connection` should be the actual variable used for your CouchDB interface and `design_path` should be the application's location where design documents will be stored. Within the design path, you should format each design document with folders and files corresponding to the fields in your design document. diff --git a/couch-client.gemspec b/couch-client.gemspec index 7925aa5..ead84be 100644 --- a/couch-client.gemspec +++ b/couch-client.gemspec @@ -2,15 +2,15 @@ Gem::Specification.new do |s| s.name = %q{couch-client} - s.version = "0.1.0" + s.version = "0.1.1" s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version= s.authors = ["Robert Sosinski"] - s.date = %q{2010-11-05} + s.date = %q{2010-11-11} s.description = %q{A Ruby interface for CouchDB} s.email = %q{email@robertsosinski.com} - s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.markdown", "TODO", "lib/couch-client.rb", "lib/couch-client/attachment.rb", "lib/couch-client/attachment_list.rb", "lib/couch-client/collection.rb", "lib/couch-client/connection.rb", "lib/couch-client/connection_handler.rb", "lib/couch-client/consistent_hash.rb", "lib/couch-client/database.rb", "lib/couch-client/design.rb", "lib/couch-client/document.rb", "lib/couch-client/hookup.rb", "lib/couch-client/row.rb"] - s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.markdown", "Rakefile", "TODO", "lib/couch-client.rb", "lib/couch-client/attachment.rb", "lib/couch-client/attachment_list.rb", "lib/couch-client/collection.rb", "lib/couch-client/connection.rb", "lib/couch-client/connection_handler.rb", "lib/couch-client/consistent_hash.rb", "lib/couch-client/database.rb", "lib/couch-client/design.rb", "lib/couch-client/document.rb", "lib/couch-client/hookup.rb", "lib/couch-client/row.rb", "spec/attachment_list_spec.rb", "spec/attachment_spec.rb", "spec/collection_spec.rb", "spec/conection_handler_spec.rb", "spec/connection_spec.rb", "spec/consistent_hash_spec.rb", "spec/couch-client_spec.rb", "spec/database_spec.rb", "spec/design_spec.rb", "spec/document_spec.rb", "spec/files/image.png", "spec/files/plain.txt", "spec/hookup_spec.rb", "spec/row_spec.rb", "spec/spec_helper.rb", "couch-client.gemspec"] + s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.markdown", "TODO", "lib/couch-client.rb", "lib/couch-client/attachment.rb", "lib/couch-client/attachment_list.rb", "lib/couch-client/collection.rb", "lib/couch-client/connection.rb", "lib/couch-client/connection_handler.rb", "lib/couch-client/consistent_hash.rb", "lib/couch-client/database.rb", "lib/couch-client/design.rb", "lib/couch-client/document.rb", "lib/couch-client/hookup.rb", "lib/couch-client/rake_task.rb", "lib/couch-client/row.rb"] + s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.markdown", "Rakefile", "TODO", "couch-client.gemspec", "lib/couch-client.rb", "lib/couch-client/attachment.rb", "lib/couch-client/attachment_list.rb", "lib/couch-client/collection.rb", "lib/couch-client/connection.rb", "lib/couch-client/connection_handler.rb", "lib/couch-client/consistent_hash.rb", "lib/couch-client/database.rb", "lib/couch-client/design.rb", "lib/couch-client/document.rb", "lib/couch-client/hookup.rb", "lib/couch-client/rake_task.rb", "lib/couch-client/row.rb", "spec/attachment_list_spec.rb", "spec/attachment_spec.rb", "spec/collection_spec.rb", "spec/conection_handler_spec.rb", "spec/connection_spec.rb", "spec/consistent_hash_spec.rb", "spec/couch-client_spec.rb", "spec/database_spec.rb", "spec/design_spec.rb", "spec/designs/create/people/fulltext/by_name/index.js", "spec/designs/create/people/validate_on_update.js", "spec/designs/create/people/views/all/map.js", "spec/designs/create/people/views/sum/map.js", "spec/designs/create/people/views/sum/reduce.js", "spec/designs/update/people/fulltext/by_name/index.js", "spec/designs/update/people/validate_on_update.js", "spec/designs/update/people/views/sum/map.js", "spec/designs/update/people/views/sum/reduce.js", "spec/document_spec.rb", "spec/files/image.png", "spec/files/plain.txt", "spec/hookup_spec.rb", "spec/rake_task_spec.rb", "spec/row_spec.rb", "spec/spec_helper.rb"] s.homepage = %q{http://github.com/robertsosinski/couch-client} s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Couch-client", "--main", "README.markdown"] s.require_paths = ["lib"] diff --git a/lib/couch-client.rb b/lib/couch-client.rb index 843b56c..89d029c 100644 --- a/lib/couch-client.rb +++ b/lib/couch-client.rb @@ -11,7 +11,7 @@ require 'couch-client/design' require 'couch-client/collection' require 'couch-client/row' -require "couch-client/rake_task" if defined?(Rake) +require 'couch-client/rake_task' if defined?(Rake) # The CouchClient module is the overall container of all CouchClient logic. module CouchClient diff --git a/lib/couch-client/hookup.rb b/lib/couch-client/hookup.rb index b7b53ff..1466b8e 100644 --- a/lib/couch-client/hookup.rb +++ b/lib/couch-client/hookup.rb @@ -87,7 +87,7 @@ def curl(verb, path = nil, query = nil, data = {}, content_type = "application/j code = easy.response_code # body is either a nil, a hash or a string containing attachment data. - body = if easy.body_str == "" || easy.body_str.nil? + body = if verb == :head # Head requests should return `nil`. nil # If the response is not a 200, then it must be JSON (as CouchDB returns all feedback as JSON), so parse it.