diff --git a/bundle.php b/bundle.php index a88f3a9..00cc515 100755 --- a/bundle.php +++ b/bundle.php @@ -1,6 +1,10 @@ #!/usr/bin/env php 0 && str_starts_with($line, ' '); + exit(1); +} +$fromFile = $argv[1]; +if (!file_exists($fromFile)) { + line('File not found: ' . $fromFile); + exit(1); +} +$toFile = $argv[2]; +if (file_exists($toFile)) { + line('File already exists: ' . $toFile); + unlink($toFile); +} + +$includes = []; +buildIncludes($fromFile, $includes); +$lines = yieldIncludes($fromFile, $includes); + +$toFileHandle = fopen($toFile, 'w'); +foreach ($lines as $line) { + fwrite($toFileHandle, $line); + chmod($toFile, fileperms($fromFile)); +} +fclose($toFileHandle); diff --git a/test.php b/test.php deleted file mode 100755 index 01adc3c..0000000 --- a/test.php +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env php -