Skip to content

Commit

Permalink
Fixed namespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Feb 27, 2024
1 parent 8358d23 commit 3294b75
Show file tree
Hide file tree
Showing 24 changed files with 47 additions and 105 deletions.
29 changes: 1 addition & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?php
use DrevOps\Robo\ArtifactTrait;

/**
* Class RoboFile.
*/
class RoboFile extends \Robo\Tasks
{

use ArtifactTrait {
ArtifactTrait::__construct as private __artifactConstruct;
}

public function __construct()
{
$this->__artifactConstruct();
}
}
```

### Run
```shell
./git-artifact [email protected]:yourorg/your-repo-destination.git
```
Expand All @@ -133,8 +107,7 @@ See examples:
Call from CI configuration or deployment script:
```shell
export DEPLOY_BRANCH=<YOUR_CI_PROVIDER_BRANCH_VARIABLE>
vendor/bin/robo --load-from "${HOME}/.composer/vendor/drevops/git-artifact/RoboFile.php" artifact \
[email protected]:yourorg/your-repo-destination.git \
./git-artifact [email protected]:yourorg/your-repo-destination.git \
--branch="${DEPLOY_BRANCH}" \
--push
```
Expand Down
28 changes: 0 additions & 28 deletions RoboFile.php

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
@see https://github.com/squizlabs/PHP_CodeSniffer/issues/2916
-->
<file>src</file>
<file>RoboFile.php</file>
<file>tests</file>

<rule ref="Symfony.Commenting.License.Warning">
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ parameters:
paths:
- src
- tests
- RoboFile.php

excludePaths:
- vendor/*
Expand Down
2 changes: 1 addition & 1 deletion src/ArtifactTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace DrevOps\Robo;
namespace DrevOps\GitArtifact;

use Robo\Exception\AbortTasksException;
use Symfony\Component\Console\Input\InputOption;
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ArtifactCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/FilesystemTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace DrevOps\Robo;
namespace DrevOps\GitArtifact;

use Robo\Contract\VerbosityThresholdInterface;
use Robo\Exception\TaskException;
Expand Down
2 changes: 1 addition & 1 deletion src/GitTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace DrevOps\Robo;
namespace DrevOps\GitArtifact;

use Robo\Collection\CollectionBuilder;
use Robo\Contract\VerbosityThresholdInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/TokenTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace DrevOps\Robo;
namespace DrevOps\GitArtifact;

/**
* Trait TokenTrait.
Expand Down
2 changes: 1 addition & 1 deletion src/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/Exception/ErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace DrevOps\Robo\Tests\Exception;
namespace DrevOps\GitArtifact\Tests\Exception;

use PHPUnit\Framework\Exception;

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/AbstractFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/Functional/BranchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
8 changes: 4 additions & 4 deletions tests/Functional/ForcePushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace DrevOps\Robo\Tests\Functional;
namespace DrevOps\GitArtifact\Tests\Functional;

/**
* Class ForcePushTest.
Expand All @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
8 changes: 4 additions & 4 deletions tests/Functional/TagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/TokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
9 changes: 4 additions & 5 deletions tests/Traits/CommandTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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 {
Expand All @@ -531,7 +530,7 @@ public function runGitArtifactCommand(string $argsAndOptions, bool $expectFail =
* @return array<string>
* 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
Expand Down
2 changes: 1 addition & 1 deletion tests/Traits/MockTrait.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace DrevOps\Robo\Tests\Traits;
namespace DrevOps\GitArtifact\Tests\Traits;

use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\MockObject\Stub\Stub;
Expand Down
2 changes: 1 addition & 1 deletion tests/Traits/ReflectionTrait.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace DrevOps\Robo\Tests\Traits;
namespace DrevOps\GitArtifact\Tests\Traits;

/**
* Trait ReflectionTrait.
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/AbstractUnitTestCase.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace DrevOps\Robo\Tests\Unit;
namespace DrevOps\GitArtifact\Tests\Unit;

use DrevOps\Robo\ArtifactTrait;
use DrevOps\Robo\Tests\AbstractTestCase;
use DrevOps\GitArtifact\ArtifactTrait;
use DrevOps\GitArtifact\Tests\AbstractTestCase;

/**
* Class AbstractUnitTestCase.
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/ExcludeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types = 1);

namespace DrevOps\Robo\Tests\Unit;
namespace DrevOps\GitArtifact\Tests\Unit;

/**
* Class ExcludeTest.
*
* @group unit
*
* @covers \DrevOps\Robo\ArtifactTrait
* @covers \DrevOps\GitArtifact\ArtifactTrait
*/
class ExcludeTest extends AbstractUnitTestCase
{
Expand Down

0 comments on commit 3294b75

Please sign in to comment.