1 | <?php |
||
8 | class RoboFile extends \Robo\Tasks |
||
|
|||
9 | { |
||
10 | public function dockertest() |
||
27 | |||
28 | |||
29 | |||
30 | /** |
||
31 | * Run All Unit Test |
||
32 | * @param array $opts |
||
33 | */ |
||
34 | public function test($opts = ['php' => '7.1', 'db' => 'mysql', 'keep-cts' => false, 'wait' => 5]) |
||
48 | |||
49 | |||
50 | private function setupDocker(string $php = '7.1', string $dbType = 'mysql', int $wait) |
||
63 | |||
64 | private function startDb($type) |
||
77 | |||
78 | |||
79 | private function startPHP(string $version, string $dbType) |
||
97 | |||
98 | |||
99 | private function destroyDocker() |
||
106 | |||
107 | |||
108 | private function stopContainer(string $ct) |
||
120 | |||
121 | /** |
||
122 | * Build phar executable. |
||
123 | */ |
||
124 | public function pharBuild() |
||
125 | { |
||
126 | // Create a collection builder to hold the temporary |
||
127 | // directory until the pack phar task runs. |
||
128 | $collection = $this->collectionBuilder(); |
||
129 | $workDir = $collection->tmpDir(); |
||
130 | $buildDir = "$workDir/neuralyzer"; |
||
131 | |||
132 | $prepTasks = $this->collectionBuilder(); |
||
133 | $preparationResult = $prepTasks |
||
134 | ->taskFilesystemStack() |
||
135 | ->mkdir($workDir) |
||
136 | |||
137 | ->taskCopyDir([ |
||
138 | __DIR__ . '/src' => $buildDir . '/src' |
||
139 | ]) |
||
140 | |||
141 | ->taskFilesystemStack() |
||
142 | ->copy(__DIR__ . '/bin/neuralyzer', $buildDir . '/bin/neuralyzer') |
||
143 | ->copy(__DIR__ . '/composer.json', $buildDir . '/composer.json') |
||
144 | ->copy(__DIR__ . '/composer.lock', $buildDir . '/composer.lock') |
||
145 | ->copy(__DIR__ . '/LICENSE', $buildDir . '/LICENSE') |
||
146 | ->copy(__DIR__ . '/README.md', $buildDir . '/README.md') |
||
147 | |||
148 | ->taskComposerInstall() |
||
149 | ->dir($buildDir) |
||
150 | ->noDev() |
||
151 | ->noScripts() |
||
152 | ->printed(true) |
||
153 | ->optimizeAutoloader() |
||
154 | ->run(); |
||
155 | |||
156 | // Exit if the preparation step failed |
||
157 | if (!$preparationResult->wasSuccessful()) { |
||
158 | return $preparationResult; |
||
159 | } |
||
160 | |||
161 | // Decide which files we're going to pack |
||
162 | $files = \Symfony\Component\Finder\Finder::create()->ignoreVCS(true) |
||
163 | ->files() |
||
164 | ->name('*.php') |
||
165 | ->name('*.exe') // for 1symfony/console/Resources/bin/hiddeninput.exe |
||
166 | ->path('src') |
||
167 | ->path('vendor') |
||
168 | ->notPath('docs') |
||
169 | ->notPath('/vendor\/.*\/[Tt]est/') |
||
170 | ->in(is_dir($buildDir) ? $buildDir : __DIR__); |
||
171 | |||
172 | // Build the phar |
||
173 | return $collection |
||
174 | ->taskPackPhar('neuralyzer.phar') |
||
175 | ->compress() |
||
176 | ->addFile('bin/neuralyzer', 'bin/neuralyzer') |
||
177 | ->addFiles($files) |
||
178 | ->executable('bin/neuralyzer') |
||
179 | ->taskFilesystemStack() |
||
180 | ->chmod(__DIR__ . '/neuralyzer.phar', 0755) |
||
181 | ->run(); |
||
182 | } |
||
183 | } |
||
184 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.