Accept being passed nil as error in -getDocumentWithId:...
Fix replicating attachments with revpos > doc generation

This is an import from:

couchbase/couchbase-lite-ios@b5ecc07c8688a5d834992a51a23cd99faf8be0db
Add shared methods for remote db code in ReplicationAcceptance
Use local CouchDB instance for all attachment replication tests
Use NSData rather than NSInputStream in attachments API

This was changed for a couple of reasons: gzipped attachments
and general API trends external to the library.

* Supporting gzipped attachments

This also allows us to inflate gzipped attachments before
returning data to client.

Some content types are zipped before storing on disk during
replication (or they come compressed from CouchDB and saved
to disk without removing the compression).

This paves the way for us to compress certain types when
added through the Cloudant Sync API.

* Why NSData rather than NSInputStream?

The iOS and OSX APIs appear to generally prefer working with either
NSData (e.g., UIImage imageWithData:) or file paths/URLs (e.g.,
UIImage imageWithContentsOfFile:). So providing NSInputStream
interfaces, while potentially more efficient, seemed like it would
be an overhead -- people would be forever writing these to files or
NSData objects anyway.

* Tests

Test which replicates gzipped data from remote database. We
need to fix exposing this data through our attachments API.
Open CDTDatastore's underlying TD_Database on -init

This helps to make sure initialisation code is only called
from one thread.
Allow results of -getAllDocuments to be used in -attachmentsForRev:...

-attachmentsForRev:... makes use of the sequence number, which
wasn't added to the TD_Revision by -getAllDocuments.
Allow comparing attachments of documents in a local and remote db
Add further attachment tests to ReplicationAcceptance

testReplicateManyLocalAttachments tests creating lots of local
attachments are successfully replicated.

testAddLocalReplicateDeleteLocalReplicate checks that deleting an
attachment from a local document that's already been replicated
remotely is replicated during a future replication.

testReplicateRemoteDocumentUpdate tests that updates to an
attachment are replicated correctly.

testReplicateRemoteDocumentDeleteLocalCheckReplicated tests that
deleting an attachment is replicated correctly.

testReplicateRemoteDocumentDeleteRemoteCheckReplicated tests that
deleting a remote attachment is replicated correctly.
Add a rake command to run ReplicationAcceptance tests
Add a rake command to pod update all projects
Significant cleanup of ReplicationAcceptance attachments tests
Merge pull request #28 from cloudant/30441-replication-attachments

30441 Add tests for replicating attachments to ReplicationAcceptance
10,000 replicated documents is probably enough in ReplicationAcceptance

And it's quicker too.
Allow ReplicationAcceptance tests to be run on devices

By adding an app to the project.
Merge pull request #30 from cloudant/28972-device-acceptance-tests

28972 Allow running ReplicationAcceptance tests on physical device
Adds support for filtered pull replication and reorganizes the
way replications are specified and initiated.

Adds CDTAbstractReplication, CDTPushReplication and CDTPullReplication, which
are used to encapsulate the data necessary to start a replication.
CDTAbstractReplication is the "abstract" base class for CDTPushReplication
and CDTPullReplication.

Adds CDTReplicatorFactory -oneWay:(CDTAbstractReplicaiton *), which accepts
a CDTAbstractReplication object to specify the replication. This method returns a
CDTReplicator, which may be used to execute the replication (CDTReplicator -start).

CDTReplicatorFactory -onewaySourceDatatore:targetURI and -onewaySoureURI:targetDatatore
will soon be deprecated in favor of -oneWay, which is documented in this commit.

CDTPullReplication supports filtered replication from the remote server. This code
does not make any query to the remote server to ensure the existence
of the remote filter function.

Tests (and supporting methods) were added to the ReplicationAcceptance
project and to CDTReplicationTests.m in the Tests project.