This repository has been archived by the owner on Jun 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRobofile.php
111 lines (100 loc) · 3.27 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
include 'vendor/autoload.php';
use Symfony\Component\Finder\Finder as Finder;
use Symfony\Component\Yaml\Parser as Parser;
/**
* This is project's console commands configuration for the Dropdock project.
*/
class Robofile extends \Robo\Tasks
{
public function release()
{
$this->yell("Releasing Dropdock");
$this->taskExecStack()
->stopOnFail()
->exec("git submodule update --init --recursive --remote")
->run();
$this->taskGitStack()
->add('-A')
->commit("auto-update")
->pull()
->push()
->run();
$this->taskGitHubRelease(\Twinbit\DropdockRunner::VERSION)
->uri('twinbit/dropdock')
->askDescription()
->run();
$this->pharPublish();
$this->versionBump();
}
/**
* Build the Dropdock phar package
*/
public function pharBuild()
{
$yaml = new Parser();
$packer = $this->taskPackPhar('dropdock.phar');
// $packer->compress(TRUE);
$this->taskComposerInstall()
->noDev()
->printed(false)
->run();
// Add php sources.
$files = Finder::create()->ignoreVCS(true)
->files()
->name('*.php')
->path('php-src')
->path('vendor')
->notPath('data')
->notPath('tmp')
->in(__DIR__);
foreach ($files as $file) {
$packer->addFile($file->getRelativePathname(), $file->getRealPath());
}
// Add binaries yaml config.
$files = Finder::create()->ignoreVCS(true)
->files()
->name('binaries.yml')
->in(__DIR__);
foreach ($files as $file) {
$packer->addFile($file->getRelativePathname(), $file->getRealPath());
}
// Add dropdock binary and make it as executable.
$packer->addFile('DropdockRoboFile.php', 'DropdockRoboFile.php');
// Add docker-compose.yml.
$packer->addFile('docker-compose.yml.dist', 'docker-compose.yml.dist');
// Add boot2local.sh script.
$packer->addFile('src/scripts/boot2local.sh', 'src/scripts/boot2local.sh');
$packer->addFile('dropdock', 'dropdock')
->executable('dropdock')
->run();
$this->taskComposerInstall()
->printed(false)
->run();
}
public function pharPublish()
{
$this->pharBuild();
rename('dropdock.phar', 'dropdock-release.phar');
$this->taskGitStack()->checkout('gh-pages')->run();
rename('dropdock-release.phar', 'dropdock.phar');
$this->taskGitStack()
->add('dropdock.phar')
->commit('dropdock.phar published')
->push('origin','gh-pages')
->checkout('master')
->run();
}
public function versionBump($version = null)
{
if (!$version) {
$versionParts = explode('.', \Twinbit\dropdockRunner::VERSION);
$versionParts[count($versionParts)-1]++;
$version = implode('.', $versionParts);
}
$this->taskReplaceInFile(__DIR__.'/php-src/DropdockRunner.php')
->from("VERSION = '".\Twinbit\dropdockRunner::VERSION."'")
->to("VERSION = '".$version."'")
->run();
}
}