<commit_before><?php
/**
 * @link http://www.diemeisterei.de/
 * @copyright Copyright (c) 2014 diemeisterei GmbH, Stuttgart
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace app\commands;

use dektrium\user\Finder;
use dektrium\user\ModelManager;
use dmstr\console\controllers\BaseAppController;
use mikehaertl\shellcommand\Command;
use yii\base\Exception;


/**
 * Task runner command for development.
 * @package console\controllers
 * @author <NAME> <<EMAIL>>
 */
class AppController extends BaseAppController
{

    public function init()
    {
        try {
            return parent::init(); // TODO: Change the autogenerated stub
        } catch (Exception $e) {
            echo "Warning: " . $e->getMessage() . "\n";
            echo "Some actions may not perform correctly\n\n";
        }
    }

    public $defaultAction = 'version';

    /**
     * Displays application version from git describe
     */
    public function actionVersion()
    {
        echo "Application Version\n";
        $cmd = new Command("git describe");
        if ($cmd->execute()) {
            echo $cmd->getOutput();
        } else {
            echo $cmd->getOutput();
            echo $cmd->getStdErr();
            echo $cmd->getError();
        }
        echo "\n";
    }

    /**
     * Update application and vendor source code, run database migrations, clear cache
     */
    public function actionUpdate()
    {
        $cmd = new Command("git pull");
        if ($cmd->execute()) {
            echo $cmd->getOutput();
        } else {
            echo $cmd->getOutput();
            echo $cmd->getStdErr();
            echo $cmd->getError();
        }
        $this->composer("install");
        $this->action('migrate');
        $this->action('cache/flush', 'cache');
    }

    /**
     * Initial application setup
     */
    public function actionSetup()
    {
        $this->action('migrate', ['interactive' => $this->interactive]);
        $this->action('app/setup-admin-user', ['interactive' => $this->interactive]);
        $this->action('app/virtual-host', ['interactive' => $this->interactive]);
    }

    /**
     * Install packages for application testing
     */
    public function actionSetupTests()
    {
        $this->action('migrate', ['interactive' => $this->interactive]);

        $this->composer(
            'global require "codeception/codeception:2.0.*" "codeception/specify:*" "codeception/verify:*"'
        );
        $this->composer(
            'require --dev "yiisoft/yii2-coding-standards:2.*" "yiisoft/yii2-codeception:2.*" "yiisoft/yii2-faker:2.*"'
        );

        // array with commands
        $commands[] = '~/.composer/vendor/bin/codecept build';

        foreach ($commands AS $command) {
            $cmd = new Command($command);
            if ($cmd->execute()) {
                echo $cmd->getOutput();
            } else {
                echo $cmd->getOutput();
                echo $cmd->getStdErr();
                echo $cmd->getError();
            }
        }
    }<commit_msg>added virtual host info message<commit_after><?php
/**
 * @link http://www.diemeisterei.de/
 * @copyright Copyright (c) 2014 diemeisterei GmbH, Stuttgart
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace app\commands;

use dektrium\user\Finder;
use dektrium\user\ModelManager;
use dmstr\console\controllers\BaseAppController;
use mikehaertl\shellcommand\Command;
use yii\base\Exception;


/**
 * Task runner command for development.
 * @package console\controllers
 * @author <NAME> <<EMAIL>>
 */
class AppController extends BaseAppController
{

    public function init()
    {
        try {
            return parent::init(); // TODO: Change the autogenerated stub
        } catch (Exception $e) {
            echo "Warning: " . $e->getMessage() . "\n";
            echo "Some actions may not perform correctly\n\n";
        }
    }

    public $defaultAction = 'version';

    /**
     * Displays application version from git describe
     */
    public function actionVersion()
    {
        echo "Application Version\n";
        $cmd = new Command("git describe");
        if ($cmd->execute()) {
            echo $cmd->getOutput();
        } else {
            echo $cmd->getOutput();
            echo $cmd->getStdErr();
            echo $cmd->getError();
        }
        echo "\n";
    }

    /**
     * Update application and vendor source code, run database migrations, clear cache
     */
    public function actionUpdate()
    {
        $cmd = new Command("git pull");
        if ($cmd->execute()) {
            echo $cmd->getOutput();
        } else {
            echo $cmd->getOutput();
            echo $cmd->getStdErr();
            echo $cmd->getError();
        }
        $this->composer("install");
        $this->action('migrate');
        $this->action('cache/flush', 'cache');
    }

    /**
     * Initial application setup
     */
    public function actionSetup()
    {
        $this->action('migrate', ['interactive' => $this->interactive]);
        $this->action('app/setup-admin-user', ['interactive' => $this->interactive]);
        $this->action('app/virtual-host', ['interactive' => $this->interactive]);
        echo "Virtual-host configuration: ".getenv('VIRTUAL_HOST')."\n";
    }

    /**
     * Install packages for application testing
     */
    public function actionSetupTests()
    {
        $this->action('migrate', ['interactive' => $this->interactive]);

        $this->composer(
            'global require "codeception/codeception:2.0.*" "codeception/specify:*" "codeception/verify:*"'
        );
        $this->composer(
            'require --dev "yiisoft/yii2-coding-standards:2.*" "yiisoft/yii2-codeception:2.*" "yiisoft/yii2-faker:2.*"'
        );

        // array with commands
        $commands[] = '~/.composer/vendor/bin/codecept build';

        foreach ($commands AS $command) {
            $cmd = new Command($command);
            if ($cmd->execute()) {
                echo $cmd->getOutput();
            } else {
                echo $cmd->getOutput();
                echo $cmd->getStdErr();
                echo $cmd->getError();
            }
        }
    }
{'fraction_non_alphanumeric': 0.1490937746256895, 'fraction_numerical': 0.0037825059101654845, 'mean_word_length': 2.1092601665850075, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 75, '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': '2329468', 'n_tokens_mistral': 1816, 'n_tokens_neox': 1774, 'n_words': 422}