Skip to content

Commit

Permalink
Remove comment from destination file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tekill committed Jun 4, 2017
1 parent 99fa0cb commit 3af1194
Show file tree
Hide file tree
Showing 21 changed files with 10 additions and 26 deletions.
4 changes: 3 additions & 1 deletion src/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ class Application extends BaseApplication
*/
public function __construct()
{
parent::__construct('Env diff', '1.0.1');
parent::__construct('Env diff', '1.0.2');

$this->setAutoExit(true);
$this->add(new DiffCommand('diff'));
$this->add(new ActualizeCommand('actualize'));

$this->setDefaultCommand('actualize');
}
}
9 changes: 3 additions & 6 deletions src/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,9 @@ public function actualizeEnv(Config $config)
}

ksort($actualEnv);
file_put_contents(
$target,
'# This file is auto-generated during the composer install' . PHP_EOL . Env::dump($actualEnv)
);
file_put_contents($target, Env::dump($actualEnv));

$this->io->write(sprintf('<info>%s has been %s</info>', $target, $exists ? 'updated' : 'created'));
$this->io->write(sprintf('<info>"%s" has been %s</info>', $target, $exists ? 'updated' : 'created'));

return false;
}
Expand Down Expand Up @@ -94,7 +91,7 @@ public function showDifference(Config $config)
return false;
}

$this->io->write(sprintf('Diff between %s and %s files:', $target, $dist));
$this->io->write(sprintf('Diff between "%s" and "%s" files:', $target, $dist));
$this->io->write('');

foreach ($missingEnv as $env => $value) {
Expand Down
1 change: 0 additions & 1 deletion tests/fixtures/actualize/delete-old-variable/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# This file is auto-generated during the composer install
FOO='bar'
SOME_VARIABLE='old'
1 change: 0 additions & 1 deletion tests/fixtures/actualize/delete-old-variable/.expected
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This file is auto-generated during the composer install
FOO='bar'
1 change: 0 additions & 1 deletion tests/fixtures/actualize/subdirectory/.expected
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# This file is auto-generated during the composer install
APPEND='new line'
FOO='bar'
1 change: 0 additions & 1 deletion tests/fixtures/actualize/valid/append-new-variable/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This file is auto-generated during the composer install
FOO='bar'
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# This file is auto-generated during the composer install
APPEND='new line'
FOO='bar'
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# This file is auto-generated during the composer install
BOOLEAN=true
FOO='bar'
NUMBER=123
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# This file is auto-generated during the composer install
FOO='bar'
SOME_VARIABLE='old'
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# This file is auto-generated during the composer install
FOO='bar'
SOME_VARIABLE='old'
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This file is auto-generated during the composer install
FOO='old'
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This file is auto-generated during the composer install
FOO='old'
1 change: 0 additions & 1 deletion tests/fixtures/actualize/valid/remove-comments/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This file is auto-generated during the composer install
FOO='bar'
1 change: 0 additions & 1 deletion tests/fixtures/actualize/valid/remove-comments/.expected
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This file is auto-generated during the composer install
FOO='bar'
1 change: 0 additions & 1 deletion tests/fixtures/actualize/valid/trim-spaces/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This file is auto-generated during the composer install
FOO='bar'
1 change: 0 additions & 1 deletion tests/fixtures/actualize/valid/trim-spaces/.expected
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# This file is auto-generated during the composer install
APPEND='new line'
FOO='bar'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Diff between .env and .env.dist files:
Diff between ".env" and ".env.dist" files:

<fg=cyan>@ APPEND='new' ('new line')</>
2 changes: 1 addition & 1 deletion tests/fixtures/difference/valid/extra-values/expected.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Diff between .env and .env.dist files:
Diff between ".env" and ".env.dist" files:

<fg=green>+ EXTRA=true</>
1 change: 0 additions & 1 deletion tests/fixtures/difference/valid/identical/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# This file is auto-generated during the composer install
APPEND='new line'
FOO='bar'
2 changes: 1 addition & 1 deletion tests/fixtures/difference/valid/missed-values/expected.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Diff between .env and .env.dist files:
Diff between ".env" and ".env.dist" files:

<fg=red>- APPEND='new line'</>
2 changes: 1 addition & 1 deletion tests/fixtures/difference/valid/mixed/expected.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Diff between .env and .env.dist files:
Diff between ".env" and ".env.dist" files:

<fg=red>- MISSED=true</>
<fg=green>+ EXTRA=true</>
Expand Down

0 comments on commit 3af1194

Please sign in to comment.