-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcreate-phar.php
46 lines (41 loc) · 1.67 KB
/
create-phar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
exec('rm -rf ' . __DIR__ . '/build');
@mkdir('./build');
$srcRoot = "~/RingCentral-Call-Generator-Recordings-Downloader/";
$buildRoot = "./build";
$phar = new Phar($buildRoot . "/RC_CallRecordings_Download.phar",
FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME, "RC_CallRecordings_Download.phar");
function listDir($root, $path, $phar)
{
//print 'Entering ' . $root . $path . PHP_EOL;
$it = new DirectoryIterator($root . $path);
foreach ($it as $fileinfo) {
$filename = $fileinfo->getFilename();
if ($fileinfo->isDot() ||
stristr($filename, 'Test.php') ||
stristr($filename, '.git') ||
stristr($filename, '.gitignore') ||
stristr($filename, 'manual_tests') ||
stristr($filename, 'tests') ||
// stristr($filename, 'demo') ||
stristr($filename, 'Call-Logs') ||
stristr($filename, 'Json') ||
stristr($filename, 'Csv') ||
stristr($filename, 'Recordings') ||
stristr($filename, '_cache') ||
stristr($filename, 'dist') ||
stristr($filename, 'build') ||
stristr($filename, 'docs')
) {
continue;
} elseif ($fileinfo->isDir()) {
listDir($root, $path . '/' . $filename, $phar);
} else {
$key = ($path ? $path . '/' : '') . $filename;
$phar[$key] = file_get_contents($root . $path . '/' . $fileinfo->getFilename());
//print ' ' . $key . ' -> ' . $path . '/' . $filename . PHP_EOL;
}
}
}
listDir(__DIR__ . '/', '', $phar);
$phar->setStub($phar->createDefaultStub("index.php"));