Skip to content
This repository was archived by the owner on Jan 1, 2020. It is now read-only.

Commit edae8ac

Browse files
committed
fix: use script for updating .gitignore
Due to quoting issues between different operating systems, the script for removing the `composer.lock` entry from the `.gitignore` file was not working on Linux after a recent update to provide support for Windows. To provide a truly cross-platform way to work, this patch provides a script, `bin/update-gitignore`, which does the work. The `composer.json` entry is updated to call that script, which deletes itself on completion.
1 parent de1020e commit edae8ac

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

bin/update-gitignore.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* @see https://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
4+
* @copyright Copyright (c) 2019 Zend Technologies USA Inc. (https://www.zend.com)
5+
* @license https://github.com/zendframework/ZendSkeletonApplication/blob/master/LICENSE.md New BSD License
6+
*/
7+
8+
$gitIgnore = sprintf('%s/.gitignore', realpath(dirname(__DIR__)));
9+
$rules = file_get_contents($gitIgnore);
10+
$rules = preg_replace("#[\r\n]+composer.lock#s", '', $rules);
11+
file_put_contents($gitIgnore, $rules);
12+
unlink(__FILE__);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"development-status": "zf-development-mode status",
122122
"post-create-project-cmd": [
123123
"@development-enable",
124-
"php -r \"$file = file_get_contents('.gitignore'); $file = str_replace('composer.lock', '', $file); file_put_contents('.gitignore', $file);\""
124+
"php bin/update-gitignore.php"
125125
],
126126
"serve": "php -S 0.0.0.0:8080 -t public",
127127
"test": "phpunit"

0 commit comments

Comments
 (0)