forked from broelik/jphp-telegram-bot-api
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpackage.build.php
More file actions
30 lines (28 loc) · 802 Bytes
/
package.build.php
File metadata and controls
30 lines (28 loc) · 802 Bytes
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
<?php
use php\io\File;
use php\lib\str;
use php\lib\fs;
use packager\Event;
/**
* @jppm-task create-bundle
*/
function task_CreateBundle(Event $e)
{
$package = $e->package();
$data = $package->getAny('develnext-bundle');
$vendorName = str::replace($data['class'], '\\', '.');
$parent = new File("src-bundle/vendor/{$vendorName}");
if($parent->isDirectory()){
fs::clean($parent);
}
foreach($package->getAny('sources') as $source){
fs::scan($source, function(File $file)use($parent, $source){
if($file->isFile()){
$newPath = new File($parent, fs::relativize($file, $source));
fs::ensureParent($newPath);
fs::copy($file, $newPath);
}
});
}
Tasks::run('bundle:build');
}