1
0
Fork 0

Fixed Windows path separators and updated docs.

pull/5184/head
Niels Keurentjes 2016-04-12 23:51:28 +02:00
parent 7e71b2bfbc
commit f5422a441d
3 changed files with 9 additions and 7 deletions

View File

@ -649,8 +649,8 @@ the console will read `Symlinked from ../../packages/my-package`. If symlinking
is _not_ possible the package will be copied. In that case, the console will
output `Mirrored from ../../packages/my-package`.
Instead of default fallback strategy you can force to use symlink with `"symlink": true` or
mirroring with `"symlink": false` option.
Instead of default fallback strategy you can force to use symlink with `"symlink": true`
or mirroring with `"symlink": false` option.
Forcing mirroring can be useful when deploying or generating package from a monolithic repository.
```json
@ -667,9 +667,11 @@ Forcing mirroring can be useful when deploying or generating package from a mono
}
```
If present on *nix systems leading tildes are expanded to the current user's home folder, which
can be handy when working on teams on the same packages. For example `~/git/mypackage` will
automatically load the mypackage clone from `/home/<username>/git/mypackage` for every developer.
Leading tildes are expanded to the current user's home folder, and environment
variables are parsed according to host platform. For example `~/git/mypackage`
will automatically load the mypackage clone from `/home/<username>/git/mypackage`,
which is equivalent to `$HOME/git/mypackage` on Linux/Mac or
`%USERPROFILE%/git/mypackage` on Windows.
> **Note:** Repository paths can also contain wildcards like ``*`` and ``?``.
> For details, see the [PHP glob function](http://php.net/glob).

View File

@ -31,7 +31,7 @@ class Platform
return self::getUserDirectory() . substr($path, 1);
}
return preg_replace_callback(self::isWindows() ? '#^(%(\\w+)%)[/\\\\]#' : '#^(\\$(\\w+))/#', function($matches) {
return getenv($matches[2]) . DIRECTORY_SEPARATOR;
return getenv($matches[2]) . '/';
}, $path);
}

View File

@ -29,7 +29,7 @@ class PlatformTest extends \PHPUnit_Framework_TestCase
} else {
$this->assertEquals('/home/test/myPath', Platform::expandPath('$TESTENV/myPath'));
}
$this->assertEquals((getenv('HOME') ?: getenv('USERPROFILE')) . DIRECTORY_SEPARATOR . 'test', Platform::expandPath('~/test'));
$this->assertEquals((getenv('HOME') ?: getenv('USERPROFILE')) . '/test', Platform::expandPath('~/test'));
}
public function testIsWindows()