Skip to content

Commit 3dadb2b

Browse files
committed
Add zero-to-prod-data-model script for publishing README to documentation directory.
1 parent c55399c commit 3dadb2b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

bin/zero-to-prod-data-model

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/**
5+
* Zero-to-Prod Factory Documentation Publisher
6+
*
7+
* Publishes the README.md file to the user's documentation directory.
8+
*/
9+
10+
require getcwd().'/vendor/autoload.php';
11+
12+
use Zerotoprod\PackageHelper\PackageHelper;
13+
14+
$target_path = getcwd().'/docs/zero-to-prod/package-helper/';
15+
if (isset($argv[1])) {
16+
$target_path = rtrim($argv[1], '/').'/';
17+
}
18+
19+
$source_file = __DIR__.'/../README.md';
20+
21+
if (!file_exists($source_file)) {
22+
fwrite(STDERR, "Error: Not found $source_file\n");
23+
exit(1);
24+
}
25+
26+
try {
27+
PackageHelper::copy($source_file, $target_path);
28+
exit(0);
29+
} catch (RuntimeException $e) {
30+
fwrite(STDERR, "Error: ".$e->getMessage()."\n");
31+
exit(1);
32+
}
33+

0 commit comments

Comments
 (0)