| @@ 153-189 (lines=37) @@ | ||
| 150 | * @param string $fileName |
|
| 151 | * @throws DocException |
|
| 152 | */ |
|
| 153 | protected function executeAglio($fileName) |
|
| 154 | { |
|
| 155 | $workingDirectory = dirname($fileName); |
|
| 156 | ||
| 157 | if ('Build' != basename($workingDirectory)) { |
|
| 158 | $pathBuild = $workingDirectory . DIRECTORY_SEPARATOR . 'Build'; |
|
| 159 | $fileSystem = new Filesystem(); |
|
| 160 | try { |
|
| 161 | $fileSystem->mkdir($pathBuild); |
|
| 162 | } catch (IOExceptionInterface $exception) { |
|
| 163 | throw new DocException( |
|
| 164 | sprintf('Can not create folder %s', $pathBuild), |
|
| 165 | 0, |
|
| 166 | $exception |
|
| 167 | ); |
|
| 168 | } |
|
| 169 | } else { |
|
| 170 | $pathBuild = $workingDirectory; |
|
| 171 | } |
|
| 172 | ||
| 173 | $createdFile = sprintf('%s/out.html', $pathBuild); |
|
| 174 | $commandLine = sprintf('aglio -i %s -o %s', $fileName, $createdFile); |
|
| 175 | $process = new Process($commandLine); |
|
| 176 | $process->setWorkingDirectory($workingDirectory); |
|
| 177 | ||
| 178 | try { |
|
| 179 | $process->mustRun(); |
|
| 180 | $this->docCreatedFiles[] = $createdFile; |
|
| 181 | } catch (ProcessFailedException $e) { |
|
| 182 | throw new DocException( |
|
| 183 | sprintf( |
|
| 184 | 'Error to generate mock file with markdown-pp: %s, maybe markdown-pp is not installed', |
|
| 185 | $e->getMessage() |
|
| 186 | ) |
|
| 187 | ); |
|
| 188 | } |
|
| 189 | } |
|
| 190 | ||
| 191 | /** |
|
| 192 | * @param string $fileName |
|
| @@ 195-231 (lines=37) @@ | ||
| 192 | * @param string $fileName |
|
| 193 | * @throws MockException |
|
| 194 | */ |
|
| 195 | protected function executeMarkdownPP($fileName) |
|
| 196 | { |
|
| 197 | $workingDirectory = dirname($fileName); |
|
| 198 | ||
| 199 | if ('Build' != basename($workingDirectory)) { |
|
| 200 | $pathBuild = $workingDirectory . DIRECTORY_SEPARATOR . 'Build'; |
|
| 201 | $fileSystem = new Filesystem(); |
|
| 202 | try { |
|
| 203 | $fileSystem->mkdir($pathBuild); |
|
| 204 | } catch (IOExceptionInterface $exception) { |
|
| 205 | throw new MockException( |
|
| 206 | sprintf('Can not create folder %s', $pathBuild), |
|
| 207 | 0, |
|
| 208 | $exception |
|
| 209 | ); |
|
| 210 | } |
|
| 211 | } else { |
|
| 212 | $pathBuild = $workingDirectory; |
|
| 213 | } |
|
| 214 | ||
| 215 | $fileCreated = sprintf('%s/out.apib', $pathBuild); |
|
| 216 | $commandLine = sprintf('markdown-pp %s -o %s', $fileName, $fileCreated); |
|
| 217 | $process = new Process($commandLine); |
|
| 218 | $process->setWorkingDirectory($workingDirectory); |
|
| 219 | ||
| 220 | try { |
|
| 221 | $process->mustRun(); |
|
| 222 | $this->compiledFiles[] = $fileCreated; |
|
| 223 | } catch (ProcessFailedException $e) { |
|
| 224 | throw new MockException( |
|
| 225 | sprintf( |
|
| 226 | 'Error to generate mock file with markdown-pp: %s, maybe markdown-pp is not installed', |
|
| 227 | $e->getMessage() |
|
| 228 | ) |
|
| 229 | ); |
|
| 230 | } |
|
| 231 | } |
|
| 232 | ||
| 233 | /** |
|
| 234 | * @return Finder |
|