Browse Source

shell updates

euromark 13 years ago
parent
commit
1ed480c6b5

+ 0 - 3
Console/Command/CcShell.php

@@ -71,9 +71,6 @@ class CcShell extends AppShell {
 		$content .= '}'.LF;
 		$content .= '}'.LF;
 		$content .= '/*** behavior end ***/'.LF;
 		$content .= '/*** behavior end ***/'.LF;
 
 
-
-		$content .= '/*** model start ***/'.LF;
-
 		$this->content .= $content;
 		$this->content .= $content;
 	}
 	}
 
 

+ 1 - 1
Console/Command/HashShell.php

@@ -1,5 +1,5 @@
 <?php
 <?php
-
+App::uses('AppShell', 'Console/Command');
 //include_once('files/sha256.inc');
 //include_once('files/sha256.inc');
 
 
 class HashShell extends AppShell {
 class HashShell extends AppShell {

+ 15 - 1
Console/Command/IndentShell.php

@@ -11,6 +11,7 @@ if (!defined('CR')) {
 	define('CR', "\r");
 	define('CR', "\r");
 }
 }
 App::uses('Folder', 'Utility');
 App::uses('Folder', 'Utility');
+App::uses('AppShell', 'Console/Command');
 
 
 /**
 /**
  * Indend Shell
  * Indend Shell
@@ -48,7 +49,12 @@ class IndentShell extends AppShell {
 			}
 			}
 
 
 			if (!empty($this->args[0]) && $this->args[0] != 'app') {
 			if (!empty($this->args[0]) && $this->args[0] != 'app') {
-				$folder = realpath($this->args[0]);
+				$folder = $this->args[0];
+				if ($folder == '/') {
+					$folder = APP;
+				}
+				
+				$folder = realpath($folder);
 				if (!file_exists($folder)) {
 				if (!file_exists($folder)) {
 					die('folder not exists: ' . $folder . '');
 					die('folder not exists: ' . $folder . '');
 				}
 				}
@@ -61,11 +67,19 @@ class IndentShell extends AppShell {
 				$this->settings['files'] = explode(',', $this->params['files']);
 				$this->settings['files'] = explode(',', $this->params['files']);
 			}
 			}
 
 
+			$this->out($folder);
+			$this->out('searching...');
 			$this->_searchFiles();
 			$this->_searchFiles();
+			
 			$this->out('found: ' . count($this->_files));
 			$this->out('found: ' . count($this->_files));
 			if ($this->settings['test']) {
 			if ($this->settings['test']) {
 				$this->out('TEST DONE');
 				$this->out('TEST DONE');
 			} else {
 			} else {
+				$continue = $this->in(__('Modifying files! Continue?'), array('y', 'n'), 'n');
+				if (strtolower($continue) != 'y' && strtolower($continue) != 'yes') {
+					die('...aborted');
+				}
+				
 				$this->_correctFiles3();
 				$this->_correctFiles3();
 				$this->out('DONE');
 				$this->out('DONE');
 			}
 			}

+ 2 - 2
Console/Command/IndexShell.php

@@ -51,7 +51,7 @@ class IndexShell extends AppShell {
 	 * @return void
 	 * @return void
 	 * @access public
 	 * @access public
 	 */
 	 */
-	function startup() {
+	public function startup() {
 		parent::startup();
 		parent::startup();
 		
 		
 		$this->_welcome();
 		$this->_welcome();
@@ -65,7 +65,7 @@ class IndexShell extends AppShell {
 	 * @return void
 	 * @return void
 	 * @access public
 	 * @access public
 	 */
 	 */
-	function initialize() {
+	public function initialize() {
 		parent::initialize();
 		parent::initialize();
 		/*
 		/*
 		if (file_exists(APP . 'Config' . DS . 'index.php')) {
 		if (file_exists(APP . 'Config' . DS . 'index.php')) {

+ 9 - 0
Console/Command/PwdShell.php

@@ -1,6 +1,15 @@
 <?php
 <?php
+App::uses('AppShell', 'Console/Command');
 App::uses('ComponentCollection', 'Controller');
 App::uses('ComponentCollection', 'Controller');
 
 
+/**
+ * password hashing and output
+ * 
+ * @cakephp 2.x
+ * @author Mark Scherer
+ * @license MIT
+ * 2011-11-05 ms
+ */
 class PwdShell extends AppShell {
 class PwdShell extends AppShell {
 	public $tasks = array();
 	public $tasks = array();
 	//public $uses = array('User');
 	//public $uses = array('User');

+ 7 - 2
Console/Command/ResetShell.php

@@ -4,10 +4,15 @@
 if (!defined('CLASS_USER')) {
 if (!defined('CLASS_USER')) {
 	define('CLASS_USER', 'User');
 	define('CLASS_USER', 'User');
 }
 }
+App::uses('AppShell', 'Console/Command');
 
 
 /**
 /**
  * reset user data
  * reset user data
- * 2011-08-01 ms
+ * 
+ * @cakephp 2.x
+ * @author Mark Scherer
+ * @license MIT
+ * 2011-11-05 ms
  */
  */
 class ResetShell extends AppShell {
 class ResetShell extends AppShell {
 	public $tasks = array();
 	public $tasks = array();
@@ -55,7 +60,7 @@ class ResetShell extends AppShell {
 		foreach ($components as $component) {
 		foreach ($components as $component) {
 			if (App::import('Component', $component)) {
 			if (App::import('Component', $component)) {
 				$component .='Component';
 				$component .='Component';
-				$this->Auth = new $component();
+				$this->Auth = new $component(new ComponentCollection());
 				break;
 				break;
 			}
 			}
 		}
 		}

+ 7 - 6
Console/Command/UserShell.php

@@ -29,8 +29,9 @@ class UserShell extends AppShell {
 		} else {
 		} else {
 			App::import('Component', 'Auth');
 			App::import('Component', 'Auth');
 			$this->Auth = new AuthComponent(new ComponentCollection());
 			$this->Auth = new AuthComponent(new ComponentCollection());
-		}
-
+		}		
+		//ConnectionManager::sourceList()
+		
 		while (empty($username)) {
 		while (empty($username)) {
 			$username = $this->in(__('Username (2 characters at least)'));
 			$username = $this->in(__('Username (2 characters at least)'));
 		}
 		}
@@ -45,7 +46,7 @@ class UserShell extends AppShell {
 
 
 			if (!empty($roles)) {
 			if (!empty($roles)) {
 				$this->out('');
 				$this->out('');
-				pr($roles);
+				$this->out(print_r($roles, true));
 			}
 			}
 
 
 			$roleIds = array_keys($roles);
 			$roleIds = array_keys($roles);
@@ -57,7 +58,7 @@ class UserShell extends AppShell {
 
 
 			if (!empty($roles)) {
 			if (!empty($roles)) {
 				$this->out('');
 				$this->out('');
-				pr ($roles);
+				$this->out(print_r($roles, true));
 			}
 			}
 
 
 			$roleIds = array_keys($roles);
 			$roleIds = array_keys($roles);
@@ -89,7 +90,7 @@ class UserShell extends AppShell {
 
 
 		if (!empty($schema['status']) && method_exists('User', 'statuses')) {
 		if (!empty($schema['status']) && method_exists('User', 'statuses')) {
 			$statuses = User::statuses();
 			$statuses = User::statuses();
-			pr($statuses);
+			$this->out(print_r($statuses, true));
 			while (empty($status)) {
 			while (empty($status)) {
 				$status = $this->in(__('Please insert a status'), array_keys($statuses));
 				$status = $this->in(__('Please insert a status'), array_keys($statuses));
 			}
 			}
@@ -97,7 +98,7 @@ class UserShell extends AppShell {
 		}
 		}
 
 
 		if (!empty($schema['email'])) {
 		if (!empty($schema['email'])) {
-			$provideEmail = $this->in(__('Provide Email? '),array('y', 'n'), 'n');
+			$provideEmail = $this->in(__('Provide Email? '), array('y', 'n'), 'n');
 			if ($provideEmail === 'y') {
 			if ($provideEmail === 'y') {
 				$email = $this->in(__('Please insert an email'));
 				$email = $this->in(__('Please insert an email'));
 				$data['User']['email'] = $email;
 				$data['User']['email'] = $email;