NEW: Rewrite self.version in create-project (Fixes #1351)

When composer create-project is called and the resulting project is disconnected from the
parent repo, self.version references no longer work.  To fix that, this patch rewrites
self.version to the actual version number as part of 'composer create-project' execution
Ensure packages in additional installed repository are not updated

The underlying assumption of the additional installed repository is that those
packages are installed in such a way that they cannot be updated. Prior to this
fix they were still candidates for change. This ensures that they are treated
like platform and root packages and are not candidates for update.
Added FilesystemException to handle errors on local filesystem.
Added earlier permission checks in local filesystem before start download.
Merge pull request #1886 from phansys/local-fs-check

Added local filesystem permission checks for self-update
Merge remote-tracking branch 'simensen/installed-packages'
Clarify code a bit
Allow JsonManipulator::addMainKey to update top level keys as well
Merge remote-tracking branch 'sminnee/create-project-self-version'
Refactor self.version update to work on all link types, refs #1883
Fix JsonManipulator handling of package links, fixes #1465
Clarify usage of addcslashes
Fix handling of multilines in previous commit
Document a hack
Fix tilde constraints without a stability suffix to work like wildcard constraints.

With this fix, a tilde constraint such as ~3.1 won't match unstable versions of 3.1,
but a wildcard constraint such as 3.1.* would.  This seems like a confusing
inconsistency, and so I have corrected it.
Refactor wildcard matching to use manipulateVersionString
Formatting updates for PSR-2 compliance.
Make namespaces much more explicit
Update 04-schema.md
Update 04-schema.md