Creates root folders.

@param OutputInterface $output
19782
private function createRootFolders(OutputInterface $output)
    {
        $em = $this->container->get('doctrine.orm.default_entity_manager');
        $repository = $this->container->get('ekyna_media.folder.repository');

        $name = FolderInterface::ROOT;
        $output->write(sprintf(
            '- <comment>%s</comment> %s ',
            ucfirst($name),
            str_pad('.', 44 - mb_strlen($name), '.', STR_PAD_LEFT)
        ));

        if (null !== $folder = $repository->findRoot()) {
            $output->writeln('already exists.');
        } else {
            $folder = new Folder();
            $folder->setName($name);

            $em->persist($folder);
            $em->flush();

            $output->writeln('created.');
        }
    }
1071262
public function createTable(InputInterface $input, OutputInterface $output)
    {
        $databse = $this->getApplication()->find('create:table');
        $databse_arguments = array(
            'command'   => 'create:table',
            'table'     => $input->getArgument('table'),
            'column'    => $input->getArgument('column')
        );
        $input_db   = new ArrayInput($databse_arguments);
        $return_db  = $databse->run($input_db,$output);
        return $output->writeln($return_db);
    }
700997
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getOption('path') ?: $this->paths[$input->getOption('type')];

        $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);

        if (file_exists($path) === true) {
            $source = $this->package($input->getArgument('name'));

            $this->migrate($output, $source, $path, $input->getOption('type'));

            $message = ucfirst($this->type) . ' created successfully!';

            return $output->writeln('<info>' . $message . '</info>');
        }

        $message = 'Folder "' . $path . '" does not exists!';

        throw new \InvalidArgumentException((string) $message);
    }
122690
private function setXliffDirectory(InputInterface $input, OutputInterface $output)
    {
        $this->txlang = $input->getOption('xliff');

        if ($this->txlang === null) {
            $this->txlang = $this->getTransifexConfigValue('/languages_tx');

            if ($this->txlang === null) {
                throw new \RuntimeException('Error: unable to determine transifex root folder.');
            }
            $this->writelnVerbose($output, sprintf('<info>automatically using xliff folder: %s</info>', $this->txlang));
        }
    }
338308
protected function displayResume(OutputInterface $output)
    {
        $output->write("Creation of a new stack [<info>{$this->collectedData['name']}</info>]", true);
        foreach ($this->collectedData['operations'] as $name => $operation) {
            $output->write(" * Operation [<info>$name</info>] with ".json_encode($operation->options), true);
        }
    }
621660
protected function build(OutputInterface $output)
    {
        $this->command->run($this->input, $output);

        $this->lastBuild = new DateTime();
    }
694654
private function blend($toBlend, OutputInterface $output)
    {
        $fs         = new Filesystem();
        $vendorDir  = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor';

        foreach ($toBlend as $vendor => $names) {
            foreach ($names as $name => $path) {
                $originPath = realpath($vendorDir . DIRECTORY_SEPARATOR . $vendor . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR));
                $targetDir  = realpath($this->bundlePath) . DIRECTORY_SEPARATOR . $vendor;
                $targetPath = $targetDir . DIRECTORY_SEPARATOR . $name;

                if (!$originPath) {
                    throw new \InvalidArgumentException(sprintf('The origin path for "%s" does not exist : "%s"', "$vendor/$name", $originPath));
                }

                if (!$fs->exists($targetDir)) {
                    $fs->mkdir($targetDir);
                }

                // Switch for symlink to hard copy or from hard copy to symlink
                if (is_link($targetPath) && (!isset($this->config['symlink']) || !$this->config['symlink'])
                    ||
                    is_dir($targetPath) && isset($this->config['symlink']) && $this->config['symlink']
                ) {
                    $fs->remove($targetPath);
                }

                if (isset($this->config['symlink']) && $this->config['symlink']) {
                    $fs->symlink($originPath, $targetPath);
                } else {
                    $fs->mirror($originPath, $targetPath, null, array('delete' => true, 'override' => true));
                }

                $output->writeln(sprintf('The library <info>%s/%s</info> has been added', $vendor, $name));
            }
        }
    }
35145
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $directory = (string) $input->getArgument('directory');
        $overwriteDefaultLpvFile = $input->getOption('overwrite');

        if ($directory !== WORKING_DIRECTORY) {
            try {
                $this->analyser->setDirectory($directory);
            } catch (\RuntimeException $e) {
                $warning = "Warning: The provided directory "
                    . "'$directory' does not exist or is not a directory.";
                $outputContent = '<error>' . $warning . '</error>';
                $output->writeln($outputContent);

                return 1;
            }
        }

        $defaultLpvFile = WORKING_DIRECTORY . DIRECTORY_SEPARATOR . '.lpv';

        if (file_exists($defaultLpvFile) && $overwriteDefaultLpvFile === false) {
            $warning = 'Warning: A default .lpv file already exists.';
            $outputContent = '<error>' . $warning . '</error>';
            $output->writeln($outputContent);

            return 1;
        }

        $defaultGlobPatterns = $this->analyser->getDefaultGlobPatterns();
        $lpvFileContent = implode("\n", $defaultGlobPatterns);

        $bytesWritten = file_put_contents(
            $defaultLpvFile,
            $lpvFileContent
        );

        if ($bytesWritten === false) {
            $warning = 'Warning: The creation of the default .lpv file failed.';
            $outputContent = '<error>' . $warning . '</error>';
            $output->writeln($outputContent);

            return 1;
        }

        $info = "<info>Created default '$defaultLpvFile' file.</info>";
        $output->writeln($info);

        return 0;
    }
915365
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $config = $this->parameters;
        $recursive = $input->getOption('recursive');
        $machine = $input->getOption('machine') ? $config->get('dotfiles.machine_name') : 'defaults';
        $backupDir = $config->get('dotfiles.backup_dir')."/src/$machine/home";
        $sourcePath = $input->getArgument('path');

        // detect source path
        $originPath = $this->detectPath($sourcePath);
        $relativePath = Toolkit::getRelativePath($originPath);
        if (0 === strpos($relativePath, '.')) {
            $relativePath = substr($relativePath, 1);
        }
        $relativePath = str_replace('.'.$sourcePath, $sourcePath, $relativePath);
        $targetPath = $backupDir.'/'.$relativePath;

        Toolkit::ensureDir($backupDir);

        $basename = basename($sourcePath);
        if (0 === strpos($basename, '.')) {
            $targetPath = str_replace('.'.$sourcePath, $basename, $targetPath);
        }

        if (is_dir($originPath)) {
            $this->doAddDir($originPath, $targetPath, $recursive);
        } else {
            $this->doAddFile($originPath, $targetPath);
        }
    }
186021
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $dir = $input->getArgument('dir');

        Console::setCustomEnvDirectory($dir);

        $output->writeln('### ENV directory has been set to '.$dir.' ###');
    }
869287
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);
        $plugins = $this
            ->pluginRepository
            ->findAll();

        /**
         * @var Plugin $plugin
         */
        foreach ($plugins as $plugin) {
            $this->printMessage(
                $output,
                'Plugin',
                $plugin->getNamespace() . ' - [Hash : ' . $plugin->getHash() . ']'
            );
        }

        $this->finishCommand($output);
    }
94336
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setIo($input, $output);

        $sourceDir = $this->container['config']['source.directory'];
        $outputDir = $this->container['config']['build.directory'];

        $output->writeln("<info>Compiling <path>{$sourceDir}</path> into <path>{$outputDir}</path></info>");

        $total = $this->runTimedTask(function () use ($sourceDir, $outputDir) {

            if ( ! $this->input->getOption('no-clean')) {
                $this->runCleanTask($outputDir);
            }

            $this->runBuildTask($sourceDir, $outputDir);

            if ( ! $this->input->getOption('no-gulp')) {
                $this->runGulpTask();
            }

        });

        $output->writeln("<info>Built in <time>{$total}ms</time></info>");
    }
141113
public function setOutput(\Symfony\Component\Console\Output\OutputInterface $output)
    {
        $this->output = $output;
    }
588559
protected function createConsoleLogger(OutputInterface $output)
    {
        return new ConsoleLogger(
            $output,
            [
                // aways output notice, info and debug
                LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL,
                LogLevel::INFO   => OutputInterface::VERBOSITY_NORMAL,
                LogLevel::DEBUG  => OutputInterface::VERBOSITY_NORMAL
            ],
            [
                // redirect messages to stderr
                LogLevel::WARNING => ConsoleLogger::INFO,
                LogLevel::NOTICE  => ConsoleLogger::ERROR,
                LogLevel::INFO    => ConsoleLogger::ERROR,
                LogLevel::DEBUG   => ConsoleLogger::ERROR
            ]
        );
    }
288861
public function createOutputDir()
    {
        $outputDir = $this->configuration->get('output');

        if (!is_writable($outputDir)) {
            @mkdir($outputDir, 0777, true);

            if (!is_writable($outputDir)) {
                throw new \RuntimeException("Output directory {$outputDir} is not writable.");
            }
        }
    }
512450
private function _generateIco(OutputInterface $output)
    {
        $filename = $this->_outputFolder . "favicon.ico";
        $output->writeln("Creating: <info>{$filename}</info>");


        $originalImage = $this->_imagine->open($this->_inputFile)->strip();
        $originalImage->copy()
                ->resize(new \Imagine\Image\Box(16, 16))
                ->save('tmp-16.bmp');

        $icon = $this->_imagine->open('tmp-16.bmp');
        $icon->layers()
                ->add($originalImage->copy()->resize(new \Imagine\Image\Box(32, 32)));

        if ($this->_use48Icon)
        {
            $icon->layers()->add($originalImage->copy()->resize(new \Imagine\Image\Box(48, 48)));
        }
        if ($this->_use64Icon)
        {
            $icon->layers()->add($originalImage->copy()->resize(new \Imagine\Image\Box(64, 64)));
        }

        $icon->save($filename, array(
            'flatten' => false
        ));

        unlink('tmp-16.bmp');
        return true;
    }
1261486
protected function newProgressBar(OutputInterface $output)
    {
        // If the console output is not decorated (i.e. it does not support
        // ANSI), use NullOutput to suppress the progress bar entirely.
        $progressOutput = $output->isDecorated() ? $output : new NullOutput();

        return new ProgressBar($progressOutput);
    }