-
Notifications
You must be signed in to change notification settings - Fork 1
/
package.php
31 lines (26 loc) · 961 Bytes
/
package.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
<?php
/**
* Package library files as a phar archive for distribution.
*
* For security, the ability to create phar archives is disabled by default. To
* change this the php.ini file must contain the following line:
* phar.readonly = Off
*/
// Package definition. In the future this would be a good place to use a
// configuration file.
require_once 'acis/acis.php';
$pkg_name = 'acis';
$pkg_init = "{$pkg_name}.php";
$pkg_ver = ACIS_VERSION;
$pkg_path = $pkg_name;
$pkg_dest = 'dist';
// Create archive.
if (!is_dir($pkg_dest) && !mkdir($pkg_dest, 0755, true)) {
throw Exception("could not create directory {$pkg_dest}");
}
$phar_name = "{$pkg_name}-${pkg_ver}.phar";
$phar_path = $pkg_dest.DIRECTORY_SEPARATOR.$phar_name;
$phar = new Phar($phar_path, 0, $phar_name);
$phar->buildFromDirectory($pkg_path, '/\.php/');
$phar->setStub(Phar::createDefaultStub($pkg_init));
printf("%d file(s) added to archive {$phar_path}".PHP_EOL, count($phar));