Skip to content

Commit

Permalink
Changed namespace to Pds\Skeleton\ and collapsed directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
afilina committed Jan 3, 2017
1 parent fddf89d commit 75771ab
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bin/pdsskeleton
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach ($autoloadFiles as $autoloadFile) {
}
}

use PDS\Skeleton\Console;
use Pds\Skeleton\Console;

$console = new Console();
$console->execute($argv);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://github.com/php-pds/skeleton",
"license": "CC-BY-SA-4.0",
"autoload": {
"psr-4": { "PDS\\Skeleton\\": "src/PDS/Skeleton" }
"psr-4": { "Pds\\Skeleton\\": "src/" }
},
"bin": ["bin/pdsskeleton"]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace PDS\Skeleton;
namespace Pds\Skeleton;

class ComplianceValidator
{
Expand Down Expand Up @@ -57,7 +57,7 @@ public function validate($lines)
public function getFiles()
{
if ($this->files == null) {
$files = scandir(__DIR__ . "/../../../../../../");
$files = scandir(__DIR__ . "/../../../../");
foreach ($files as $i => $file) {
if (is_dir($file)) {
$files[$i] .= "/";
Expand Down
6 changes: 3 additions & 3 deletions src/PDS/Skeleton/Console.php → src/Console.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace PDS\Skeleton;
namespace Pds\Skeleton;

class Console
{
protected $commandsWhitelist = [
'validate' => 'PDS\Skeleton\ComplianceValidator',
'generate' => 'PDS\Skeleton\PackageGenerator',
'validate' => 'Pds\Skeleton\ComplianceValidator',
'generate' => 'Pds\Skeleton\PackageGenerator',
];

public function execute($args)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace PDS\Skeleton;
namespace Pds\Skeleton;

use PDS\Skeleton\ComplianceValidator;
use Pds\Skeleton\ComplianceValidator;

class PackageGenerator
{
Expand All @@ -19,21 +19,24 @@ public function execute()
public function createFiles($validatorResults, $root = null)
{
if ($root == null) {
$root = realpath(__DIR__ . "/../../../../../../");
$root = realpath(__DIR__ . "/../../../../");
}
$files = $this->createFileList($validatorResults);
foreach ($files as $file) {
$createdFiles = [];
foreach ($files as $i => $file) {
$isDir = substr($file, -1, 1) == '/';
if ($isDir) {
$path = $root . '/' . substr($file, 0, -1);
$createdFiles[$file] = $path;
mkdir($path, 0755);
continue;
}
$path = $root . '/' . $file . '.md';
$createdFiles[$file] = $file . '.md';
file_put_contents($path, '');
chmod($path, 0644);
}
return $files;
return $createdFiles;
}

public function createFileList($validatorResults)
Expand Down
2 changes: 1 addition & 1 deletion tests/ComplianceValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
}

use PDS\Skeleton\ComplianceValidator;
use Pds\Skeleton\ComplianceValidator;

$tester = new ComplianceValidatorTest();
// Test all 4 possible states.
Expand Down
4 changes: 2 additions & 2 deletions tests/PackageGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
}
}

use PDS\Skeleton\ComplianceValidator;
use PDS\Skeleton\PackageGenerator;
use Pds\Skeleton\ComplianceValidator;
use Pds\Skeleton\PackageGenerator;

$tester = new PackageGeneratorTest();
$tester->testGenerate_WithMissingBin_ReturnsBin();
Expand Down

0 comments on commit 75771ab

Please sign in to comment.