Skip to content

Commit f336ae6

Browse files
committedAug 31, 2017
Fix config key mismatch, update readme
1 parent 3af1194 commit f336ae6

10 files changed

+31
-8
lines changed
 

‎README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
EnvDiff is tool to compare environment keys to find the difference between .env files and actualize them.
1010

11+
![Example cast](https://j.gifs.com/y8RGA6.gif)
12+
1113
# Installation
1214

1315
```
14-
composer install tekill/env-diff
16+
composer require tekill/env-diff
1517
```
1618

1719
## Manual running
@@ -129,7 +131,7 @@ check_run() {
129131
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
130132
}
131133
132-
# Aclualize env files if the `env.dist` file gets changed
134+
# Actualize env files if the `env.dist` file gets changed
133135
check_run env.dist "php ./vendor/bin/env-diff aclualize"
134136
```
135137

‎env-diff

100644100755
File mode changed.

‎src/Composer/ScriptHandler.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
class ScriptHandler
1313
{
14+
const CONFIG_KEY = 'lf-env-diff';
15+
1416
/**
1517
* @param Event $event
1618
*
@@ -54,7 +56,7 @@ private static function extractConfigs(Event $event)
5456
{
5557
$extras = $event->getComposer()->getPackage()->getExtra();
5658

57-
$configs = isset($extras['lf-diff-env']) ? $extras['lf-diff-env'] : [[]];
59+
$configs = isset($extras[self::CONFIG_KEY]) ? $extras[self::CONFIG_KEY] : [[]];
5860

5961
if (!is_array($configs)) {
6062
throw new InvalidArgumentException(

‎src/Config.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class Config
66
{
77
const DEFAULT_TARGET = '.env';
8-
CONST DEFAULT_DIST = '.env.dist';
8+
const DEFAULT_DIST = '.env.dist';
99

1010
/** @var string */
1111
private $dist;

‎src/Console/Application.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
use LF\EnvDiff\Console\Command\ActualizeCommand;
66
use LF\EnvDiff\Console\Command\DiffCommand;
77
use Symfony\Component\Console\Application as BaseApplication;
8+
use Symfony\Component\Console\Exception\LogicException;
89

910
class Application extends BaseApplication
1011
{
1112
/**
1213
* {@inheritdoc}
14+
*
15+
* @throws LogicException
1316
*/
1417
public function __construct()
1518
{
16-
parent::__construct('Env diff', '1.0.2');
19+
parent::__construct('Env diff', '1.0.3');
1720

1821
$this->setAutoExit(true);
1922
$this->add(new DiffCommand('diff'));

‎src/Console/Command/AbstractCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use LF\EnvDiff\IO\ConsoleIO;
77
use LF\EnvDiff\Processor;
88
use Symfony\Component\Console\Command\Command;
9+
use Symfony\Component\Console\Exception\InvalidArgumentException;
910
use Symfony\Component\Console\Input\InputInterface;
1011
use Symfony\Component\Console\Input\InputOption;
1112
use Symfony\Component\Console\Output\OutputInterface;
@@ -25,6 +26,8 @@ protected function configure()
2526

2627
/**
2728
* {@inheritdoc}
29+
*
30+
* @throws InvalidArgumentException
2831
*/
2932
protected function execute(InputInterface $input, OutputInterface $output)
3033
{
@@ -40,6 +43,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
4043
* @param InputInterface $input
4144
*
4245
* @return Config
46+
*
47+
* @throws InvalidArgumentException
4348
*/
4449
private function createConfig(InputInterface $input)
4550
{

‎src/Console/Command/ActualizeCommand.php

+5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
namespace LF\EnvDiff\Console\Command;
44

5+
use InvalidArgumentException;
56
use LF\EnvDiff\Config;
67
use LF\EnvDiff\Processor;
8+
use RuntimeException;
79

810
class ActualizeCommand extends AbstractCommand
911
{
1012
/**
1113
* @param Processor $processor
1214
* @param Config $config
15+
*
16+
* @throws RuntimeException
17+
* @throws InvalidArgumentException
1318
*/
1419
protected function doExecute(Processor $processor, Config $config)
1520
{

‎src/Console/Command/DiffCommand.php

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace LF\EnvDiff\Console\Command;
44

5+
use InvalidArgumentException;
56
use LF\EnvDiff\Config;
67
use LF\EnvDiff\Processor;
78

@@ -10,6 +11,8 @@ class DiffCommand extends AbstractCommand
1011
/**
1112
* @param Processor $processor
1213
* @param Config $config
14+
*
15+
* @throws InvalidArgumentException
1316
*/
1417
protected function doExecute(Processor $processor, Config $config)
1518
{

‎src/IO/ConsoleIO.php

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace LF\EnvDiff\IO;
44

5+
use Symfony\Component\Console\Exception\RuntimeException;
56
use Symfony\Component\Console\Helper\QuestionHelper;
67
use Symfony\Component\Console\Input\InputInterface;
78
use Symfony\Component\Console\Output\OutputInterface;
@@ -52,6 +53,8 @@ public function isInteractive()
5253

5354
/**
5455
* {@inheritdoc}
56+
*
57+
* @throws RuntimeException
5558
*/
5659
public function ask($question, $default = null)
5760
{

‎tests/Composer/ScriptHandlerTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public function provideInvalidConfiguration()
2020
{
2121
return [
2222
'invalid type' => [
23-
['lf-diff-env' => 'not an array'],
23+
['lf-env-diff' => 'not an array'],
2424
'The extra.lf-env-diff setting must be an array or a configuration object',
2525
],
2626
'invalid type for multiple configs' => [
27-
['lf-diff-env' => ['not an array']],
27+
['lf-env-diff' => ['not an array']],
2828
'The extra.lf-env-diff setting must be an array of configuration objects',
2929
],
3030
];
@@ -76,7 +76,7 @@ public function provideValidConfiguration()
7676
return [
7777
[
7878
[
79-
'lf-diff-env' => [
79+
'lf-env-diff' => [
8080
[
8181
'dist' => 'fixtures/difference/valid/identical/.env.dist',
8282
'target' => 'fixtures/difference/valid/identical/.env'

0 commit comments

Comments
 (0)
Please sign in to comment.