From 07e110ac036592faed4bab01bdfe2c80dbbb0951 Mon Sep 17 00:00:00 2001 From: Daniel Lowrey Date: Thu, 30 Jul 2015 10:10:53 -0400 Subject: [PATCH] renaming --- README.md | 16 ++--- composer.json | 11 ++- ...ckingFilesystem.php => BlockingDriver.php} | 4 +- lib/{Filesystem.php => Driver.php} | 4 +- lib/{EioFilesystem.php => EioDriver.php} | 4 +- lib/{UvFilesystem.php => UvDriver.php} | 4 +- lib/functions.php | 31 ++++---- test/BlockingDriverTest.php | 10 +++ test/BlockingFilesystemTest.php | 10 --- test/{FilesystemTest.php => DriverTest.php} | 70 +++++++++---------- ...ioFilesystemTest.php => EioDriverTest.php} | 6 +- ...{UvFilesystemTest.php => UvDriverTest.php} | 7 +- 12 files changed, 89 insertions(+), 88 deletions(-) rename lib/{BlockingFilesystem.php => BlockingDriver.php} (97%) rename lib/{Filesystem.php => Driver.php} (98%) rename lib/{EioFilesystem.php => EioDriver.php} (99%) rename lib/{UvFilesystem.php => UvDriver.php} (99%) create mode 100644 test/BlockingDriverTest.php delete mode 100644 test/BlockingFilesystemTest.php rename test/{FilesystemTest.php => DriverTest.php} (64%) rename test/{EioFilesystemTest.php => EioDriverTest.php} (63%) rename test/{UvFilesystemTest.php => UvDriverTest.php} (68%) diff --git a/README.md b/README.md index d4fd4d6..d79d416 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# fs +# filesystem -[![Build Status](https://img.shields.io/travis/amphp/fs/master.svg?style=flat-square)](https://travis-ci.org/amphp/fs) -[![CoverageStatus](https://img.shields.io/coveralls/amphp/fs/master.svg?style=flat-square)](https://coveralls.io/github/amphp/fs?branch=master) +[![Build Status](https://img.shields.io/travis/amphp/filesystem/master.svg?style=flat-square)](https://travis-ci.org/amphp/filesystem) +[![CoverageStatus](https://img.shields.io/coveralls/amphp/filesystem/master.svg?style=flat-square)](https://coveralls.io/github/amphp/filesystem?branch=master) ![Unstable](https://img.shields.io/badge/api-unstable-orange.svg?style=flat-square) ![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square) -`amphp/fs` is a non-blocking filesystem library for use with the [`amp`](https://github.com/amphp/amp) +`amphp/filesystem` is a non-blocking filesystem library for use with the [`amp`](https://github.com/amphp/amp) concurrency framework. **Dependencies** @@ -15,19 +15,19 @@ concurrency framework. - [eio](https://pecl.php.net/package/eio) - [php-uv](https://github.com/bwoebi/php-uv) (experimental, requires PHP7) -`amphp/fs` works out of the box without any PHP extensions but it does so using +`amphp/filesystem` works out of the box without any PHP extensions but it does so using blocking functions. This capability only exists to simplify development across -environments where extensions may not be present. Using `amp/fs` in production +environments where extensions may not be present. Using `amphp/filesystem` in production without pecl/eio or php-uv is **NOT** recommended. **Current Version** -`amphp/fs` is currently pre-alpha software and has no tagged releases. Your mileage may vary. +`amphp/filesystem` is currently pre-alpha software and has no tagged releases. Your mileage may vary. **Installation** ```bash -$ composer require amphp/fs:dev-master +$ composer require amphp/filesystem:dev-master ``` **TODO** diff --git a/composer.json b/composer.json index 555eba6..cc0634f 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "amphp/fs", - "homepage": "https://github.com/amphp/fs", + "name": "amphp/filesystem", + "homepage": "https://github.com/amphp/filesystem", "description": "Non-blocking filesystem tools for amp applications", "keywords": [ "filesystem", @@ -14,8 +14,7 @@ "authors": [ { "name": "Daniel Lowrey", - "email": "rdlowrey@php.net", - "role": "Creator / Lead Developer" + "email": "rdlowrey@php.net" } ], "require": { @@ -29,13 +28,13 @@ }, "autoload": { "psr-4": { - "Amp\\Fs\\": "lib" + "Amp\\Filesystem\\": "lib" }, "files": ["lib/functions.php"] }, "autoload-dev": { "psr-4": { - "Amp\\Fs\\Test\\": "test/" + "Amp\\Filesystem\\Test\\": "test/" } }, "extra": { diff --git a/lib/BlockingFilesystem.php b/lib/BlockingDriver.php similarity index 97% rename from lib/BlockingFilesystem.php rename to lib/BlockingDriver.php index cc725f3..fb3787d 100644 --- a/lib/BlockingFilesystem.php +++ b/lib/BlockingDriver.php @@ -1,12 +1,12 @@ assertSame($expected, $actual); }); @@ -69,9 +69,9 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { $target = "{$fixtureDir}/small.txt"; $link = "{$fixtureDir}/symlink.txt"; - $this->assertTrue(yield \Amp\Fs\symlink($target, $link)); + $this->assertTrue(yield \Amp\Filesystem\symlink($target, $link)); $this->assertTrue(\is_link($link)); - yield \Amp\Fs\unlink($link); + yield \Amp\Filesystem\unlink($link); }); } @@ -81,9 +81,9 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { $target = "{$fixtureDir}/small.txt"; $link = "{$fixtureDir}/symlink.txt"; - $this->assertTrue(yield \Amp\Fs\symlink($target, $link)); - $this->assertTrue(is_array(yield \Amp\Fs\lstat($link))); - yield \Amp\Fs\unlink($link); + $this->assertTrue(yield \Amp\Filesystem\symlink($target, $link)); + $this->assertTrue(is_array(yield \Amp\Filesystem\lstat($link))); + yield \Amp\Filesystem\unlink($link); }); } @@ -91,7 +91,7 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { \Amp\run(function () { $fixtureDir = self::getFixturePath(); - $stat = (yield \Amp\Fs\stat("{$fixtureDir}/small.txt")); + $stat = (yield \Amp\Filesystem\stat("{$fixtureDir}/small.txt")); $this->assertInternalType("array", $stat); $this->assertTrue($stat["isfile"]); $this->assertFalse($stat["isdir"]); @@ -102,7 +102,7 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { \Amp\run(function () { $fixtureDir = self::getFixturePath(); - $stat = (yield \Amp\Fs\stat("{$fixtureDir}/dir")); + $stat = (yield \Amp\Filesystem\stat("{$fixtureDir}/dir")); $this->assertInternalType("array", $stat); $this->assertTrue($stat["isdir"]); $this->assertFalse($stat["isfile"]); @@ -113,7 +113,7 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { \Amp\run(function () { $fixtureDir = self::getFixturePath(); - $stat = (yield \Amp\Fs\stat("{$fixtureDir}/nonexistent")); + $stat = (yield \Amp\Filesystem\stat("{$fixtureDir}/nonexistent")); $this->assertNull($stat); }); } @@ -126,10 +126,10 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { $old = "{$fixtureDir}/rename1.txt"; $new = "{$fixtureDir}/rename2.txt"; - yield \Amp\Fs\put($old, $contents1); - yield \Amp\Fs\rename($old, $new); - $contents2 = (yield \Amp\Fs\get($new)); - yield \Amp\Fs\unlink($new); + yield \Amp\Filesystem\put($old, $contents1); + yield \Amp\Filesystem\rename($old, $new); + $contents2 = (yield \Amp\Filesystem\get($new)); + yield \Amp\Filesystem\unlink($new); $this->assertSame($contents1, $contents2); }); @@ -141,10 +141,10 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { $toUnlink = "{$fixtureDir}/unlink"; - yield \Amp\Fs\put($toUnlink, "unlink me"); - $this->assertTrue((bool) (yield \Amp\Fs\stat($toUnlink))); - yield \Amp\Fs\unlink($toUnlink); - $this->assertNull(yield \Amp\Fs\stat($toUnlink)); + yield \Amp\Filesystem\put($toUnlink, "unlink me"); + $this->assertTrue((bool) (yield \Amp\Filesystem\stat($toUnlink))); + yield \Amp\Filesystem\unlink($toUnlink); + $this->assertNull(yield \Amp\Filesystem\stat($toUnlink)); }); } @@ -154,12 +154,12 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { $dir = "{$fixtureDir}/newdir"; - yield \Amp\Fs\mkdir($dir); - $stat = (yield \Amp\Fs\stat($dir)); + yield \Amp\Filesystem\mkdir($dir); + $stat = (yield \Amp\Filesystem\stat($dir)); $this->assertTrue($stat["isdir"]); $this->assertFalse($stat["isfile"]); - yield \Amp\Fs\rmdir($dir); - $this->assertNull(yield \Amp\Fs\stat($dir)); + yield \Amp\Filesystem\rmdir($dir); + $this->assertNull(yield \Amp\Filesystem\stat($dir)); }); } @@ -171,13 +171,13 @@ abstract class FilesystemTest extends \PHPUnit_Framework_TestCase { $fixtureDir = self::getFixturePath(); $touch = "{$fixtureDir}/touch"; - yield \Amp\Fs\put($touch, "touch me"); + yield \Amp\Filesystem\put($touch, "touch me"); - $oldStat = (yield \Amp\Fs\stat($touch)); + $oldStat = (yield \Amp\Filesystem\stat($touch)); sleep(1); - yield \Amp\Fs\touch($touch); - $newStat = (yield \Amp\Fs\stat($touch)); - yield \Amp\Fs\unlink($touch); + yield \Amp\Filesystem\touch($touch); + $newStat = (yield \Amp\Filesystem\stat($touch)); + yield \Amp\Filesystem\unlink($touch); $this->assertTrue($newStat["atime"] > $oldStat["atime"]); $this->assertTrue($newStat["mtime"] > $oldStat["mtime"]); diff --git a/test/EioFilesystemTest.php b/test/EioDriverTest.php similarity index 63% rename from test/EioFilesystemTest.php rename to test/EioDriverTest.php index 530f1e4..1e6280f 100644 --- a/test/EioFilesystemTest.php +++ b/test/EioDriverTest.php @@ -1,12 +1,12 @@ markTestSkipped( "eio extension not loaded" diff --git a/test/UvFilesystemTest.php b/test/UvDriverTest.php similarity index 68% rename from test/UvFilesystemTest.php rename to test/UvDriverTest.php index 7e1a957..49895aa 100644 --- a/test/UvFilesystemTest.php +++ b/test/UvDriverTest.php @@ -1,13 +1,14 @@ markTestSkipped( "php-uv extension not loaded"