diff --git a/src/Traefik.php b/Traefik.php similarity index 81% rename from src/Traefik.php rename to Traefik.php index 88033f4cfc6a59fba745017a829c08fb7532118e..072844f3543e7ae49abffedef76a755601103693 100644 --- a/src/Traefik.php +++ b/Traefik.php @@ -5,39 +5,46 @@ namespace LakeDrops\DockerTraefik; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Yaml\Yaml; +/** + * Class Traefik. + * + * @package LakeDrops\DockerTraefik + */ class Traefik { - /** @var string */ + /** + * The name of the project using Traefik. + * + * @var string + */ protected $name; - /** @var Filesystem */ - protected $fs; - /** * Traefik constructor. * * @param string $name - * Name of the network to be created which needs to match the container - * prefix of your project you would like to handle with Traefik. + * Name of the network to be created which needs to match the container + * prefix of your project you would like to handle with Traefik. */ public function __construct($name) { $this->name = $name; - $this->fs = new Filesystem(); } /** * Update the Traefik container. */ public function update() { - // Update host wider traefik container + // Update host wider traefik container. $traefikPath = $_SERVER['HOME'] . '/.traefik'; $traefikFile = $traefikPath . '/docker-compose.yml'; - if ($this->fs->exists($traefikFile)) { + /* @var FileSystem $fs */ + $fs = new Filesystem(); + if ($fs->exists($traefikFile)) { $traefik = Yaml::parse(file_get_contents($traefikFile)); } else { - $this->fs->mkdir($traefikPath); + $fs->mkdir($traefikPath); $traefik = [ 'version' => '2', 'services' => [ diff --git a/composer.json b/composer.json index 8d2b827ad3b5de2e8cb0708692164fe68b3f9696..77652f802b96534f4b4088e927fce3d3f6455052 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Library to prepare local Traefik Docker container which is used by e.g. Docker4Drupal.", "type": "library", "keywords": ["Drupal", "Development", "Docker"], - "homepage": "https://gitlab.lakedrops.com/composer/plugin/docker-traefik", + "homepage": "https://gitlab.lakedrops.com/composer/library/docker-traefik", "license": "GPL-2.0+", "authors": [ { @@ -20,20 +20,25 @@ } ], "support": { - "issues": "https://gitlab.lakedrops.com/composer/plugin/docker-traefik/issues", - "source": "https://gitlab.lakedrops.com/composer/plugin/docker-traefik/tree/master" + "issues": "https://gitlab.lakedrops.com/composer/library/docker-traefik/issues", + "source": "https://gitlab.lakedrops.com/composer/library/docker-traefik/tree/master" }, "require": { "php": ">=5.6", - "symfony/filesystem": "^2", - "symfony/yaml": "^2" + "symfony/filesystem": "^3", + "symfony/yaml": "^3" }, + "require-dev": { + "composer/composer": "^1.5.0", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", + "drupal/coder": "^8.2", + "phpunit/phpunit": "^4.8.0" + }, + "minimum-stability": "dev", + "prefer-stable": true, "autoload": { "psr-4": { - "LakeDrops\\DockerTraefik\\": "src/" + "LakeDrops\\DockerTraefik\\": "" } - }, - "require-dev": { - "phpunit/phpunit": "^4.4.0" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 03b6e5f008374510a8af9847c0c8288310a16405..0000000000000000000000000000000000000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" - backupGlobals="false" - colors="true" - bootstrap="vendor/autoload.php" - verbose="true" -> - <testsuites> - <testsuite name="docker-traefik"> - <directory>./tests/</directory> - </testsuite> - </testsuites> -</phpunit> diff --git a/tests/TraefikTest.php b/tests/TraefikTest.php deleted file mode 100644 index 3be9c0ddce6719e42b1491976fa34b2471a59f9c..0000000000000000000000000000000000000000 --- a/tests/TraefikTest.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -/** - * @file - * Contains \LakeDrops\DockerTraefik\Tests\TraefikTest. - */ - -namespace LakeDrops\DockerTraefik\Tests; - -use LakeDrops\DockerTraefik\Traefik; -use PHPUnit\Framework\TestCase; - -/** - * Tests composer library functionality. - */ -class TraefikTest extends TestCase { - - static $name = 'docker-traefik'; - - /** - * Test if we can initialize the main class. - */ - public function testComposerInstallAndUpdate() { - $traefik = new Traefik('test'); - $this->assertInstanceOf('LakeDrops\DockerTraefik\Traefik', $traefik); - } - -}