<commit_before><?php

App::uses('AppShell', 'Console/Command');
App::uses('Folder', 'Utility');

/**
 * BuildTask
 */
class DeployTask extends AppShell {

    /**
     * Wipe the output diretory and repopulate it using what you can see
     * browsing your development install as the input
     */
    public function execute() {
        $date = date("Y-m-d-Hi");
        $this->out('Uploading new version');

        $dryRun = false;
        $output = rtrim($this->outputDir, '/');
        $server = Configure::read('Phase.deploy.server');
        $source = Configure::read('Phase.deploy.source');
        $webroot = Configure::read('Phase.deploy.public');
        $domain = 'ad7six.com';

        $commands = array(
            "rsync -rv $output/ $server:$source{$date}",
            "ssh $server 'rm $webroot && ln -sf $source{$date} $webroot'"
        );

        foreach($commands as $command) {
            $this->out($command);
            if (!$dryRun) {
                passthru($command);
            }
        }
    }

	public function getOptionParser() {
		$parser = parent::getOptionParser();
        $parser->description(array(
            __d('phase', 'Generate a static version of the site for deployment'),
        ))->addArgument('output', array(
            'help' => __d('phase', 'Where to put the generated files'),
            'required' => false,
        ));
        return $parser;

		return $parser->description(
				__d('cake_console', 'Bake a controller for a model. Using options you can bake public, admin or both.')
			)->addArgument('name', array(
				'help' => __d('cake_console', 'Name of the controller to bake. Can use Plugin.name to bake controllers into plugins.')
			))->addOption('public', array(
				'help' => __d('cake_console', 'Bake a controller with basic crud actions (index, view, add, edit, delete).'),
				'boolean' => true
			))->addOption('admin', array(
				'help' => __d('cake_console', 'Bake a controller with crud actions for one of the Routing.prefixes.'),
				'boolean' => true
			))->addOption('plugin', array(
				'short' => 'p',
				'help' => __d('cake_console', 'Plugin to bake the controller into.')
			))->addOption('connection', array(
				'short' => 'c',
				'help' => __d('cake_console', 'The connection the controller\'s model is on.')
			))->addSubcommand('all', array(
				'help' => __d('cake_console', 'Bake all controllers with CRUD methods.')
			))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));
	}
}<commit_msg>update deploy task<commit_after><?php

App::uses('AppShell', 'Console/Command');
App::uses('Folder', 'Utility');

/**
 * BuildTask
 */
class DeployTask extends AppShell {

    public $outputDir = 'publish';

	public function getOptionParser() {
		$parser = parent::getOptionParser();
        $parser->description(array(
            __d('phase', 'Upload static site to public server'),
        ))->addArgument('path', array(
            'help' => __d('phase', 'Source dir to copy, defaults to "%s"', $this->outputDir),
        ))->addOption('server', array(
            'help' => __d('phase', 'Remote server name'),
        ))->addOption('remotePath', array(
            'help' => __d('phase', 'Location of deployed versions'),
        ))->addOption('docroot', array(
            'help' => __d('phase', 'Remote docroot'),
        ))->addOption('dry-run', array(
            'help' => __d('phase', 'Don\'t do anything, just show the commands'),
            'boolean' => true,
            'short' => 'n'
        ));
        return $parser;
	}

    /**
     * Wipe the output diretory and repopulate it using what you can see
     * browsing your development install as the input
     */
    public function execute() {
        $date = date("Y-m-d-Hi");

        $dryRun = false;
        $output = rtrim($this->outputDir, '/');
        $server = Configure::read('Phase.deploy.server');
        $source = Configure::read('Phase.deploy.source');
        $docroot = Configure::read('Phase.deploy.public');

        if (!empty($this->params['dry-run'])) {
            $dryRun = true;
        }
        if (!empty($this->params['server'])) {
            $server = $this->params['server'];
        }
        if (!empty($this->params['remotePath'])) {
            $source = rtrim($this->params['remotePath'], '/') . '/';
        }
        if (!empty($this->params['docroot'])) {
            $docroot = $this->params['docroot'];
        }

        $commands = array(
            "rsync -rv $output/ $server:$source{$date}",
            "ssh $server 'rm $docroot && ln -sf $source{$date} $docroot'"
        );

        if ($dryRun) {
            $this->out('Commands to be run:');
        } else {
            $this->out('Uploading new version');
        }

        foreach($commands as $command) {
            $this->out($command);
            if (!$dryRun) {
                passthru($command);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.17308856163001815, 'fraction_numerical': 0.00020173492031470649, 'mean_word_length': 2.462290502793296, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5197697', 'n_tokens_mistral': 1528, 'n_tokens_neox': 1433, 'n_words': 377}