-
Notifications
You must be signed in to change notification settings - Fork 13
/
RoboFile.php
44 lines (42 loc) · 1.18 KB
/
RoboFile.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
<?php
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
// define public methods as commands
/**
* Creates release zip
*
* @param string $version Version to build.
*/
public function release( $version = 'dev-master' ) {
$package = "youzanyun/open-sdk";
list( $vendor, $name ) = explode( '/', $package );
if ( empty( $vendor ) || empty( $name ) ) {
return;
}
$this->_mkdir( 'release' );
$this->taskExec( "composer create-project {$package} {$name} {$version}" )
->dir( __DIR__ . '/release' )
->arg( '--prefer-dist' )
->arg( '--no-dev' )
->run();
$this->taskExec( 'composer remove composer/installers --update-no-dev' )
->dir( __DIR__ . "/release/{$name}" )
->run();
$this->taskExec( 'composer dump-autoload --optimize' )
->dir( __DIR__ . "/release/{$name}" )
->run();
$zipFile = "release/{$vendor}-{$name}.zip";
$this->_remove( $zipFile );
$this->taskPack( $zipFile )
->addDir( $name, "release/{$name}" )
->run();
if ( ! empty( $name ) ) {
$this->_deleteDir( "release/{$name}" );
}
}
}