<commit_before><?php
/**
 * Template Task can generate templated output Used in other Tasks
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.console.libs.tasks
 * @since         CakePHP(tm) v 1.3
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class TemplateTask extends Shell {

/**
 * variables to add to template scope
 *
 * @var array
 */
	var $templateVars = array();

/**
 * Paths to look for templates on.
 * Contains a list of $theme => $path
 *
 * @var array
 */
	var $templatePaths = array();

/**
 * Initialize callback.  Setup paths for the template task.
 *
 * @access public
 * @return void
 */
	function initialize() {
		$this->templatePaths = $this->_findThemes();
	}

/**
 * Find the paths to all the installed shell themes in the app.
 *
 * Bake themes are directories not named `skel` inside a `vendors/shells/templates` path.
 *
 * @return array Array of bake themes that are installed.
 */
	function _findThemes() {
		$paths = App::path('shells');
		$core = array_pop($paths);
		$core = preg_replace('#libs' . DS . '$#', '', $core);
		$paths[] = $core;
		$Folder =& new Folder($core . 'templates' . DS . 'default');
		$contents = $Folder->read();
		$themeFolders = $contents[0];

		$plugins = App::objects('plugin');
		foreach ($plugins as $plugin) {
			$paths[] = $this->_pluginPath($plugin) . 'vendors' . DS . 'shells' . DS;
		}

		// TEMPORARY TODO remove when all paths are DS terminated
		foreach ($paths as $i => $path) {
			$paths[$i] = rtrim($path, DS) . DS;
		}<commit_msg>Fixing template task path replacements under windows.  Fixes #771<commit_after><?php
/**
 * Template Task can generate templated output Used in other Tasks
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.console.libs.tasks
 * @since         CakePHP(tm) v 1.3
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class TemplateTask extends Shell {

/**
 * variables to add to template scope
 *
 * @var array
 */
	var $templateVars = array();

/**
 * Paths to look for templates on.
 * Contains a list of $theme => $path
 *
 * @var array
 */
	var $templatePaths = array();

/**
 * Initialize callback.  Setup paths for the template task.
 *
 * @access public
 * @return void
 */
	function initialize() {
		$this->templatePaths = $this->_findThemes();
	}

/**
 * Find the paths to all the installed shell themes in the app.
 *
 * Bake themes are directories not named `skel` inside a `vendors/shells/templates` path.
 *
 * @return array Array of bake themes that are installed.
 */
	function _findThemes() {
		$paths = App::path('shells');
		$core = array_pop($paths);
		$separator = DS === '/' ? '/' : '\\\\';
		$core = preg_replace('#libs' . $separator . '$#', '', $core);
		$paths[] = $core;
		$Folder =& new Folder($core . 'templates' . DS . 'default');
		$contents = $Folder->read();
		$themeFolders = $contents[0];

		$plugins = App::objects('plugin');
		foreach ($plugins as $plugin) {
			$paths[] = $this->_pluginPath($plugin) . 'vendors' . DS . 'shells' . DS;
		}

		// TEMPORARY TODO remove when all paths are DS terminated
		foreach ($paths as $i => $path) {
			$paths[$i] = rtrim($path, DS) . DS;
		}
{'fraction_non_alphanumeric': 0.1503444881889764, 'fraction_numerical': 0.01107283464566929, 'mean_word_length': 3.3061440677966103, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3851504', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1247, 'n_words': 406}