Skip to content

Commit

Permalink
Release prep.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcarey committed Apr 10, 2010
1 parent aed1edc commit 9b85b88
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 29 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Expand Up @@ -2,6 +2,7 @@ Balint Erdi
David Lee
Frederick Cheung
James Rosen
Karel Minarik
Niket Patel
Paul Carey
Priit Tamboom
48 changes: 22 additions & 26 deletions README.textile
@@ -1,18 +1,15 @@
h3. What's New?

* 2009-10-31
** Confirmed that the test suite passes against CouchDB 0.10.0
* 2009-08-15
** A few tweaks, patches and fixes push the version to 0.3.5, compatible with CouchDB 0.9.1 and the 0.10 branch.
** The Rails error_messages_for helper is now supported. Thanks to "Balint Erdi":http://github.com/balinterdi.
* 2009-05-27
** Added minimal support for data migrations. Although CouchDB's nature removes the necessity for migrations, certain knowledge that all objects possess a particular property can simplify client logic. This desire for simplification is the rationale behind this change.
* 2009-04-19
** Defaults to taf2-curb, falling back to Net/HTTP if it taf2-curb can't be loaded. Thanks to "Fred Cheung":http://www.spacevatican.org/2009/4/13/fun-with-ruby-http-clients.
** For those interested in using RelaxDB with an ETag based cache, "look here":http://github.com/fcheung/relaxdb/commit/1d9acfd5f6b3c23da0d275252b6a6e064865440e

* 2009-03-31
** RelaxDB 0.3 released - compatible with CouchDB 0.9.
* 2010-04-10
** RelaxDB 0.4 released. Supports Ruby 1.9.1 and CouchDB 0.11.0.
** Auto-generated views no longer emit the document as a value by default
** Erlang view shorthand supported e.g. _sum and _count
** Added single query pagination
** Performance improvements
** Time.to_json fix. Thanks to "Karmi":http://github.com/karmi
** *Note*: This release includes a number of breaking changes. Please see the "release notes":http://github.com/paulcarey/relaxdb/blob/master/RELEASE_NOTES.textile for upgrading notes.

For those interested in using RelaxDB with an ETag based cache, please see "Fred Cheung's work":http://github.com/fcheung/relaxdb/commit/1d9acfd5f6b3c23da0d275252b6a6e064865440e

h2. Overview

Expand All @@ -24,8 +21,6 @@ A basic merb plugin, "merb_relaxdb":http://github.com/paulcarey/merb_relaxdb/tre

For more complete documentation take a look at docs/spec_results.html and the corresponding specs.

*Note*: While RelaxDB 0.3 is explicitly compatible with CouchDB 0.9, HEAD typically tracks CouchDB HEAD.

h2. Details

h3. Getting started
Expand All @@ -38,7 +33,9 @@ h3. Getting started
RelaxDB.configure :host => "localhost", :port => 5984, :design_doc => "app"
RelaxDB.use_db "relaxdb_scratch"

RelaxDB.enable_view_creation # creates views when class definition is executed
RelaxDB.enable_view_creation # creates views when class definition is executed

RelaxDB::View.design_doc.save # save views to CouchDB after executing class definitions
</code>
</pre>

Expand Down Expand Up @@ -67,9 +64,10 @@ class Invite < RelaxDB::Document
property :sender_name,
:derived => [:sender, lambda { |p, o| o.sender.name } ]

view_docs_by :sender_name
view_docs_by :sender_id
view_docs_by :recipient_id, :created_at, :descending => true
view_by :sender_name # Emits 1 as the map value
view_docs_by :sender_id # Emits the doc as the map value

view_by :recipient_id, :created_at, :descending => true

def on_update_conflict
puts "conflict!"
Expand Down Expand Up @@ -97,10 +95,11 @@ i.save!
il = RelaxDB.load i._id
puts i == il # true

ir = Invite.by_sender_name "sofa"
ir = Invite.by_sender_name "sofa"
puts i == ir # true

ix = Invite.by_sender_name(:key => "sofa").first
ix_ids = Invite.by_sender_name :key => "sofa"
ix = ix_ids.load!.first
puts i == ix # true

# Denormalization
Expand Down Expand Up @@ -164,12 +163,9 @@ h3. Creating views by hand
emit(doc.state, doc);
}

// Uses the CouchDB builtin to invoke an Erlang reduce fun
function Invites_by_state-reduce(keys, values, rereduce) {
if (rereduce) {
return sum(values);
} else {
return values.length;
}
_count
}
$

Expand Down
29 changes: 29 additions & 0 deletions RELEASE_NOTES.textile
@@ -0,0 +1,29 @@
h3. RelaxDB 0.4

RelaxDB 0.4 contains a number of breaking changes. However, most clients should be able to upgrade smoothly.

h4. Views

The largest change concerns automatic view generation. Prior to 0.4 an invocation of `view_by :foo` would create a JavaScript view in CouchDB of the form `emit(doc.foo, doc);`. This idiom is generally advised against. It makes view generation comparatively slow, and in particular, causes performance issues for large databases. In 0.4 `view_by :foo` now creates a map of the form `emit(doc.foo, 1);` and creates a reduce using the `_sum` builtin.

If view size isn't an issue for you, legacy behaviour can be preserved by replacing all invocations of `view_by` with `view_docs_by`. Similarly, any invocations of `RelaxDB.view` against auto-generated views should be replaced with `RelaxDB.docs`.

Note that `view_by` invocations no longer add paginate methods to the current class. Paginating over these views should be done with one of `RelaxDB.paginate` or `RelaxDB.qpaginate`.

h4. View Uploading

The standard idiom for saving autogenerated views is now

<pre>
<code>
RelaxDB.enable_view_creation
require File.dirname(__FILE__) + '/spec_models.rb'
RelaxDB::View.design_doc.save
</code>
</pre>

The explicit call to `.save` is new in 0.4. It was added to enable creating all views in a single request, rather than requiring a request per view.

h4. Pagination

The standard paginate method makes three requests against CouchDB. One to retrieve the docs and a further two to determine if next and prev links should exist. In some instances it may be preferable to save two requests and present potentially spurious pagination links. The qpaginate method does just this.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -4,7 +4,7 @@ require 'spec/rake/spectask'

PLUGIN = "relaxdb"
NAME = "relaxdb"
GEM_VERSION = "0.3.5"
GEM_VERSION = "0.4"
AUTHOR = "Paul Carey"
EMAIL = "paul.p.carey@gmail.com"
HOMEPAGE = "http://github.com/paulcarey/relaxdb/"
Expand Down
4 changes: 2 additions & 2 deletions relaxdb.gemspec
Expand Up @@ -3,8 +3,8 @@

Gem::Specification.new do |s|
s.name = "relaxdb"
s.version = "0.3.5"
s.date = "2009-08-15"
s.version = "0.4"
s.date = "2010-04-10"
s.summary = "RelaxDB provides a simple interface to CouchDB"
s.email = "paul.p.carey@gmail.com"
s.homepage = "http://github.com/paulcarey/relaxdb/"
Expand Down

0 comments on commit 9b85b88

Please sign in to comment.