Skip to content

Commit c47975d

Browse files
committed
wip
1 parent 5c8a09d commit c47975d

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

build.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
if (!file_exists('vendor')) {
3+
include 'install.php';
4+
}
25

36
function removeIgnored(string $dir, array &$entries, array $ignore)
47
{
@@ -117,6 +120,4 @@ function run(string $base, array $dirs, string $filename, array $ignore, array $
117120
'vendor/psr',
118121
];
119122

120-
exec('php test.php');
121-
122123
run(__DIR__, ['vendor', 'src'], 'api.php', $ignore, $priority);

patch.php renamed to install.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
<?php
22

3-
function runDir(string $base, string $dir): int
3+
if (!file_exists('composer.phar')) {
4+
$composer = file_get_contents('https://getcomposer.org/composer.phar');
5+
file_put_contents('composer.phar', $composer);
6+
}
7+
if (!file_exists('vendor')) {
8+
exec('php composer.phar install');
9+
exec('php patch.php');
10+
}
11+
12+
function patchDir(string $base, string $dir): int
413
{
514
$count = 0;
615
$entries = scandir($dir);
@@ -10,7 +19,7 @@ function runDir(string $base, string $dir): int
1019
}
1120
$filename = "$base/$dir/$entry";
1221
if (is_dir($filename)) {
13-
$count += runDir($base, "$dir/$entry");
22+
$count += patchDir($base, "$dir/$entry");
1423
}
1524
}
1625
foreach ($entries as $entry) {
@@ -32,12 +41,12 @@ function runDir(string $base, string $dir): int
3241
return $count;
3342
}
3443

35-
function run(string $base, array $dirs)
44+
function patch(string $base, array $dirs)
3645
{
3746
$start = microtime(true);
3847
$count = 0;
3948
foreach ($dirs as $dir) {
40-
$count += runDir($base, $dir);
49+
$count += patchDir($base, $dir);
4150
}
4251
$end = microtime(true);
4352
$time = ($end - $start) * 1000;
@@ -46,4 +55,4 @@ function run(string $base, array $dirs)
4655
}
4756
}
4857

49-
run(__DIR__, ['vendor']);
58+
patch(__DIR__, ['vendor']);

test.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@
55
use Tqdev\PhpCrudApi\RequestFactory;
66
use Tqdev\PhpCrudApi\ResponseUtils;
77

8-
if (!file_exists('composer.phar')) {
9-
$composer = file_get_contents('https://getcomposer.org/composer.phar');
10-
file_put_contents('composer.phar', $composer);
11-
}
128
if (!file_exists('vendor')) {
13-
exec('php composer.phar install');
9+
include 'install.php';
1410
}
15-
exec('php patch.php');
1611

1712
require 'vendor/autoload.php';
1813

0 commit comments

Comments
 (0)