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
Show we don't support replicated gzipped data yet

Test which replicates gzipped data from remote database. We
need to fix exposing this data through our attachments API.
Use NSData rather than NSInputStream in attachments API

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.
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 also paves the way for us to compress certain types when
added through the Cloudant Sync 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 test for creating lots of local attachments and replicating
Add further attachment tests to ReplicationAcceptance

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.
Allow running the replication acceptance tests from rake
Add a rake command to pod update all projects