<commit_before><?php
/*
 * This file is part of the RedKite CMS InstallerBundle and it is distributed
 * under the MIT LICENSE. To use this application you must leave
 * intact this copyright notice.
 *
 * Copyright (c) RedKiteCms <<EMAIL>>
 *
 * For the full copyright and license infomation, please view the LICENSE
 * file that was distributed with this source code.
 *
 * For extra documentation and help please visit http://www.redkite-labs.com
 *
 * @license    MIT LICENSE
 *
 */

namespace RedKiteCms\InstallerBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use RedKiteCms\InstallerBundle\Core\Installer\Configurator\Configurator;
use RedKiteCms\InstallerBundle\Core\Installer\Environments\Environments;
use RedKiteCms\InstallerBundle\Core\Validator\Validator;

/**
 * Prepares the RedKite CMS configuration files
 *
 * @author RedKite Labs <<EMAIL>>
 */
class ConfigureCmsCommand extends ContainerAwareCommand
{
    /**
     * @see Command
     */
    protected function configure()
    {
        $this
            ->setDescription('Installs the RedKite CMS for your system')
            ->setDefinition($this->getBaseOptions())
            ->setName('redkitecms:configure');
    }

    /**
     * @see Command
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $container = $this->getContainer();
            $options = $this->inputOptionsToArray($input);

            $configuration = new Configurator($container->getParameter('kernel.root_dir'), $options);
            $this->writeMessages($output, $configuration->configure(), true);        
            $output->writeln("<info>The configuration has been written</info>");

            $installer = new Environments($container->getParameter('kernel.root_dir'), $options);        
            $this->writeMessages($output, $installer->setUp(), true);
            $output->writeln("<info>The RedKite CMS environments have been set up</info>");
        }
        catch(\Exception $ex) {
            $output->writeln("<error>" . $ex ->getMessage() . "</error>");
            
            return 0;
        }
        
        return 1;
    }<commit_msg>updated to return -1 when the command fails<commit_after><?php
/*
 * This file is part of the RedKite CMS InstallerBundle and it is distributed
 * under the MIT LICENSE. To use this application you must leave
 * intact this copyright notice.
 *
 * Copyright (c) RedKiteCms <<EMAIL>>
 *
 * For the full copyright and license infomation, please view the LICENSE
 * file that was distributed with this source code.
 *
 * For extra documentation and help please visit http://www.redkite-labs.com
 *
 * @license    MIT LICENSE
 *
 */

namespace RedKiteCms\InstallerBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use RedKiteCms\InstallerBundle\Core\Installer\Configurator\Configurator;
use RedKiteCms\InstallerBundle\Core\Installer\Environments\Environments;
use RedKiteCms\InstallerBundle\Core\Validator\Validator;

/**
 * Prepares the RedKite CMS configuration files
 *
 * @author RedKite Labs <<EMAIL>>
 */
class ConfigureCmsCommand extends ContainerAwareCommand
{
    /**
     * @see Command
     */
    protected function configure()
    {
        $this
            ->setDescription('Installs the RedKite CMS for your system')
            ->setDefinition($this->getBaseOptions())
            ->setName('redkitecms:configure');
    }

    /**
     * @see Command
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $container = $this->getContainer();
            $options = $this->inputOptionsToArray($input);

            $configuration = new Configurator($container->getParameter('kernel.root_dir'), $options);
            $this->writeMessages($output, $configuration->configure(), true);        
            $output->writeln("<info>The configuration has been written</info>");

            $installer = new Environments($container->getParameter('kernel.root_dir'), $options);        
            $this->writeMessages($output, $installer->setUp(), true);
            $output->writeln("<info>The RedKite CMS environments have been set up</info>");
        }
        catch(\Exception $ex) {
            $output->writeln("<error>" . $ex ->getMessage() . "</error>");
            
            return -1;
        }
        
        return 1;
    }
{'fraction_non_alphanumeric': 0.11574753617110506, 'fraction_numerical': 0.0010484378276368212, 'mean_word_length': 3.001677852348993, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6622105', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1274, 'n_words': 323}