diff --git a/README.md b/README.md index a5ed720..8ac33e0 100644 --- a/README.md +++ b/README.md @@ -90,32 +90,6 @@ composer require drevops/git-artifact ``` ## Usage - -Use provided [`RoboFile.php`](RoboFile.php) or create a custom `RoboFile.php` -in your repository with the following content: - -```php -__artifactConstruct(); - } -} -``` - -### Run ```shell ./git-artifact git@github.com:yourorg/your-repo-destination.git ``` @@ -133,8 +107,7 @@ See examples: Call from CI configuration or deployment script: ```shell export DEPLOY_BRANCH= -vendor/bin/robo --load-from "${HOME}/.composer/vendor/drevops/git-artifact/RoboFile.php" artifact \ - git@github.com:yourorg/your-repo-destination.git \ +./git-artifact git@github.com:yourorg/your-repo-destination.git \ --branch="${DEPLOY_BRANCH}" \ --push ``` diff --git a/RoboFile.php b/RoboFile.php deleted file mode 100644 index 5a50b09..0000000 --- a/RoboFile.php +++ /dev/null @@ -1,28 +0,0 @@ -__artifactConstruct(); - } -} diff --git a/composer.json b/composer.json index c1f46cd..dfe4266 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "drevops/git-artifact", - "type": "robo-tasks", + "type": "package", "description": "Build artifact from your codebase in CI and push it to a separate git repo.", "license": "GPL-2.0-or-later", "authors": [ @@ -29,12 +29,12 @@ }, "autoload": { "psr-4": { - "DrevOps\\Robo\\": "src" + "DrevOps\\GitArtifact\\": "src" } }, "autoload-dev": { "psr-4": { - "DrevOps\\Robo\\Tests\\": "tests" + "DrevOps\\GitArtifact\\Tests\\": "tests" } }, "config": { diff --git a/phpcs.xml b/phpcs.xml index 413f987..635443c 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -20,7 +20,6 @@ @see https://github.com/squizlabs/PHP_CodeSniffer/issues/2916 --> src - RoboFile.php tests diff --git a/phpstan.neon b/phpstan.neon index 351833b..9444048 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,7 +9,6 @@ parameters: paths: - src - tests - - RoboFile.php excludePaths: - vendor/* diff --git a/src/ArtifactTrait.php b/src/ArtifactTrait.php index b45ef2f..06ec6e4 100644 --- a/src/ArtifactTrait.php +++ b/src/ArtifactTrait.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DrevOps\Robo; +namespace DrevOps\GitArtifact; use Robo\Exception\AbortTasksException; use Symfony\Component\Console\Input\InputOption; diff --git a/src/Commands/ArtifactCommand.php b/src/Commands/ArtifactCommand.php index 1b62abb..c8a03f0 100644 --- a/src/Commands/ArtifactCommand.php +++ b/src/Commands/ArtifactCommand.php @@ -2,7 +2,7 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Commands; +namespace DrevOps\GitArtifact\Commands; use Robo\Runner; use Symfony\Component\Console\Command\Command; diff --git a/src/FilesystemTrait.php b/src/FilesystemTrait.php index 42f493e..bc23535 100644 --- a/src/FilesystemTrait.php +++ b/src/FilesystemTrait.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace DrevOps\Robo; +namespace DrevOps\GitArtifact; use Robo\Contract\VerbosityThresholdInterface; use Robo\Exception\TaskException; diff --git a/src/GitTrait.php b/src/GitTrait.php index b594729..6bc28ae 100644 --- a/src/GitTrait.php +++ b/src/GitTrait.php @@ -2,7 +2,7 @@ declare(strict_types = 1); -namespace DrevOps\Robo; +namespace DrevOps\GitArtifact; use Robo\Collection\CollectionBuilder; use Robo\Contract\VerbosityThresholdInterface; diff --git a/src/TokenTrait.php b/src/TokenTrait.php index 88424d7..07ced0e 100644 --- a/src/TokenTrait.php +++ b/src/TokenTrait.php @@ -2,7 +2,7 @@ declare(strict_types = 1); -namespace DrevOps\Robo; +namespace DrevOps\GitArtifact; /** * Trait TokenTrait. diff --git a/src/app.php b/src/app.php index 05d2acf..94f7746 100644 --- a/src/app.php +++ b/src/app.php @@ -5,7 +5,7 @@ * Main entry point for the application. */ use Robo\Runner; -use DrevOps\Robo\Commands\ArtifactCommand; +use DrevOps\GitArtifact\Commands\ArtifactCommand; use Symfony\Component\Console\Application; $application = new Application(); diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php index 70095af..a7a784f 100644 --- a/tests/AbstractTestCase.php +++ b/tests/AbstractTestCase.php @@ -2,11 +2,11 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests; +namespace DrevOps\GitArtifact\Tests; -use DrevOps\Robo\Tests\Traits\CommandTrait; -use DrevOps\Robo\Tests\Traits\MockTrait; -use DrevOps\Robo\Tests\Traits\ReflectionTrait; +use DrevOps\GitArtifact\Tests\Traits\CommandTrait; +use DrevOps\GitArtifact\Tests\Traits\MockTrait; +use DrevOps\GitArtifact\Tests\Traits\ReflectionTrait; use PHPUnit\Framework\TestCase; use Symfony\Component\Filesystem\Filesystem; @@ -50,7 +50,7 @@ protected function setUp(): void $this->fs = new Filesystem(); - $this->fixtureDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.'robo_git_artifact'; + $this->fixtureDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.'git_artifact'; $this->fs->mkdir($this->fixtureDir); $this->commandTraitSetUp( diff --git a/tests/Exception/ErrorException.php b/tests/Exception/ErrorException.php index 537d37c..be199d1 100644 --- a/tests/Exception/ErrorException.php +++ b/tests/Exception/ErrorException.php @@ -2,7 +2,7 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests\Exception; +namespace DrevOps\GitArtifact\Tests\Exception; use PHPUnit\Framework\Exception; diff --git a/tests/Functional/AbstractFunctionalTestCase.php b/tests/Functional/AbstractFunctionalTestCase.php index c037698..db84c00 100644 --- a/tests/Functional/AbstractFunctionalTestCase.php +++ b/tests/Functional/AbstractFunctionalTestCase.php @@ -2,9 +2,9 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests\Functional; +namespace DrevOps\GitArtifact\Tests\Functional; -use DrevOps\Robo\Tests\AbstractTestCase; +use DrevOps\GitArtifact\Tests\AbstractTestCase; /** * Class AbstractTestCase diff --git a/tests/Functional/BranchTest.php b/tests/Functional/BranchTest.php index ee7f725..1658782 100644 --- a/tests/Functional/BranchTest.php +++ b/tests/Functional/BranchTest.php @@ -2,16 +2,16 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests\Functional; +namespace DrevOps\GitArtifact\Tests\Functional; /** * Class BranchTest. * * @group integration * - * @covers \DrevOps\Robo\GitTrait - * @covers \DrevOps\Robo\ArtifactTrait - * @covers \DrevOps\Robo\FilesystemTrait + * @covers \DrevOps\GitArtifact\GitTrait + * @covers \DrevOps\GitArtifact\ArtifactTrait + * @covers \DrevOps\GitArtifact\FilesystemTrait */ class BranchTest extends AbstractFunctionalTestCase { diff --git a/tests/Functional/ForcePushTest.php b/tests/Functional/ForcePushTest.php index c86f8ac..d325966 100644 --- a/tests/Functional/ForcePushTest.php +++ b/tests/Functional/ForcePushTest.php @@ -2,7 +2,7 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests\Functional; +namespace DrevOps\GitArtifact\Tests\Functional; /** * Class ForcePushTest. @@ -11,9 +11,9 @@ * * @SuppressWarnings(PHPMD.TooManyPublicMethods) * - * @covers \DrevOps\Robo\GitTrait - * @covers \DrevOps\Robo\ArtifactTrait - * @covers \DrevOps\Robo\FilesystemTrait + * @covers \DrevOps\GitArtifact\GitTrait + * @covers \DrevOps\GitArtifact\ArtifactTrait + * @covers \DrevOps\GitArtifact\FilesystemTrait */ class ForcePushTest extends AbstractFunctionalTestCase { diff --git a/tests/Functional/GeneralTest.php b/tests/Functional/GeneralTest.php index c2645f3..8c2e54b 100644 --- a/tests/Functional/GeneralTest.php +++ b/tests/Functional/GeneralTest.php @@ -2,15 +2,15 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests\Functional; +namespace DrevOps\GitArtifact\Tests\Functional; /** * Class GeneralTest. * * @group integration * - * @covers \DrevOps\Robo\ArtifactTrait - * @covers \DrevOps\Robo\FilesystemTrait + * @covers \DrevOps\GitArtifact\ArtifactTrait + * @covers \DrevOps\GitArtifact\FilesystemTrait */ class GeneralTest extends AbstractFunctionalTestCase { diff --git a/tests/Functional/TagTest.php b/tests/Functional/TagTest.php index ba80aeb..e4c7673 100644 --- a/tests/Functional/TagTest.php +++ b/tests/Functional/TagTest.php @@ -2,16 +2,16 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests\Functional; +namespace DrevOps\GitArtifact\Tests\Functional; /** * Class TagTest. * * @group integration * - * @covers \DrevOps\Robo\GitTrait - * @covers \DrevOps\Robo\ArtifactTrait - * @covers \DrevOps\Robo\FilesystemTrait + * @covers \DrevOps\GitArtifact\GitTrait + * @covers \DrevOps\GitArtifact\ArtifactTrait + * @covers \DrevOps\GitArtifact\FilesystemTrait */ class TagTest extends AbstractFunctionalTestCase { diff --git a/tests/Functional/TokenTest.php b/tests/Functional/TokenTest.php index 7268426..5187e72 100644 --- a/tests/Functional/TokenTest.php +++ b/tests/Functional/TokenTest.php @@ -2,16 +2,16 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests\Functional; +namespace DrevOps\GitArtifact\Tests\Functional; -use DrevOps\Robo\TokenTrait; +use DrevOps\GitArtifact\TokenTrait; /** * Class ForcePushTest. * * @group integration * - * @covers \DrevOps\Robo\TokenTrait + * @covers \DrevOps\GitArtifact\TokenTrait */ class TokenTest extends AbstractFunctionalTestCase { diff --git a/tests/Traits/CommandTrait.php b/tests/Traits/CommandTrait.php index df936be..9d8a078 100644 --- a/tests/Traits/CommandTrait.php +++ b/tests/Traits/CommandTrait.php @@ -2,11 +2,10 @@ declare(strict_types = 1); -namespace DrevOps\Robo\Tests\Traits; +namespace DrevOps\GitArtifact\Tests\Traits; -use DrevOps\Robo\Tests\Exception\ErrorException; +use DrevOps\GitArtifact\Tests\Exception\ErrorException; use PHPUnit\Framework\AssertionFailedError; -use SebastianBergmann\GlobalState\RuntimeException; use Symfony\Component\Filesystem\Filesystem; /** @@ -504,7 +503,7 @@ protected function runGitCommand(string $args, string $path = null): array public function runGitArtifactCommand(string $argsAndOptions, bool $expectFail = false, string $gitArtifactBin = './git-artifact'): array { if (!file_exists($gitArtifactBin)) { - throw new RuntimeException(sprintf('git-artifact binary is not available at path "%s"', $gitArtifactBin)); + throw new \RuntimeException(sprintf('git-artifact binary is not available at path "%s"', $gitArtifactBin)); } try { @@ -531,7 +530,7 @@ public function runGitArtifactCommand(string $argsAndOptions, bool $expectFail = * @return array * Array of output lines. * - * @throws \DrevOps\Robo\Tests\Exception\ErrorException + * @throws \DrevOps\GitArtifact\Tests\Exception\ErrorException * If commands exists with non-zero status. */ protected function runCliCommand(string $command): array diff --git a/tests/Traits/MockTrait.php b/tests/Traits/MockTrait.php index 54ead3a..ff0af70 100644 --- a/tests/Traits/MockTrait.php +++ b/tests/Traits/MockTrait.php @@ -1,6 +1,6 @@