/** * @param InputInterface $input * @param OutputInterface $output * * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { if ('development' != $input->getArgument('environment') && 'production' != $input->getArgument('environment')) { return $output->writeln($input->getArgument('environment') . ' environment not found'); } $jsMinifier = new JS(); $cssMinifier = new CSS(); $output->writeln('Building environment: ' . $input->getArgument('environment')); $output->write('Generating JavaScript build file...'); $jsFiles = FileSystem::listDirectoryRecursive(Application::webRoot() . '/js', '/^.+\\.js$/i'); $buildFile = fopen(Application::webRoot() . '/min/build.js', 'w'); foreach ($jsFiles as $filePath) { fwrite($buildFile, file_get_contents($filePath) . "\n\n"); } fclose($buildFile); $output->writeln('done'); $output->write('Shrinking JavaScript...'); $jsMinifier->add(Application::webRoot() . '/min/build.js'); $jsMinifier->minify(Application::webRoot() . '/min/build.min.js'); $output->writeln('done'); $output->write('Compiling less files...'); $less = new \lessc(); $less->compileFile(Application::webRoot() . '/media/importer.less', Application::webRoot() . '/min/build.css'); $output->writeln('done'); $output->write('Shrinking css files...'); $cssMinifier->add(Application::webRoot() . '/min/build.css'); $cssMinifier->minify(Application::webRoot() . '/min/build.min.css'); $output->writeln('done'); return null; }
public function testFileSystemListDirectory() { $this->assertNotEmpty(FileSystem::listDirectory(__DIR__ . '/../'), 'Listing files works'); }