-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
730 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
$autoloadPaths = [ | ||
__DIR__ . '/../../autoload.php', | ||
__DIR__ . '/../vendor/autoload.php', | ||
__DIR__ . '/vendor/autoload.php' | ||
]; | ||
|
||
foreach ($autoloadPaths as $path) { | ||
if (file_exists($path)) { | ||
require_once $path; | ||
|
||
$config = []; | ||
|
||
$processor = new LF\EnvDiff\Processor( | ||
new \LF\EnvDiff\IO\ConsoleIO( | ||
new \Symfony\Component\Console\Input\ArgvInput(), | ||
new \Symfony\Component\Console\Output\ConsoleOutput() | ||
) | ||
); | ||
|
||
$processor->actualizeEnv(LF\EnvDiff\Config::createFormArray($config)); | ||
$processor->showDifference(LF\EnvDiff\Config::createFormArray($config)); | ||
|
||
exit(0); | ||
} | ||
} | ||
|
||
fwrite( | ||
STDERR, | ||
'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL . | ||
' composer install' . PHP_EOL . PHP_EOL . | ||
'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL | ||
); | ||
|
||
exit(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace LF\EnvDiff; | ||
|
||
use InvalidArgumentException; | ||
use LF\EnvDiff\Env\Dumper; | ||
use LF\EnvDiff\Env\Parser; | ||
|
||
class Env | ||
{ | ||
/** | ||
* @param array $envArray | ||
* | ||
* @return string | ||
*/ | ||
public static function dump(array $envArray) | ||
{ | ||
return (new Dumper())->dump($envArray); | ||
} | ||
|
||
/** | ||
* @param string $path | ||
* | ||
* @return array | ||
* | ||
* @throws InvalidArgumentException | ||
*/ | ||
public static function parse($path) | ||
{ | ||
return (new Parser())->parse($path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace LF\EnvDiff\IO; | ||
|
||
use Composer\IO\IOInterface as ComposerIOInterface; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class ComposerIO implements IOInterface | ||
{ | ||
/** @var ComposerIOInterface */ | ||
private $io; | ||
|
||
/** | ||
* ComposerIO constructor. | ||
* | ||
* @param ComposerIOInterface $io | ||
*/ | ||
public function __construct(ComposerIOInterface $io) | ||
{ | ||
$this->io = $io; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function write($message) | ||
{ | ||
$this->io->write($message); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function isInteractive() | ||
{ | ||
return $this->io->isInteractive(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function ask($question, $default = null) | ||
{ | ||
return $this->ask($question, $default); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace LF\EnvDiff\IO; | ||
|
||
use Symfony\Component\Console\Helper\QuestionHelper; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Question\Question; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
class ConsoleIO implements IOInterface | ||
{ | ||
/** @var InputInterface */ | ||
private $input; | ||
|
||
/** @var OutputInterface */ | ||
private $output; | ||
|
||
/** @var QuestionHelper */ | ||
private $questionHelper; | ||
|
||
/** | ||
* ConsoleIO constructor. | ||
* | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
*/ | ||
public function __construct(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->input = $input; | ||
$this->output = $output; | ||
$this->questionHelper = new QuestionHelper(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function write($message) | ||
{ | ||
$this->output->writeln($message); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function isInteractive() | ||
{ | ||
$this->input->isInteractive(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function ask($question, $default = null) | ||
{ | ||
return $this->questionHelper->ask($this->input, $this->output, new Question($question, $default)); | ||
} | ||
} |
Oops, something went wrong.