Starting to remove Dispatch->params in favor of the constants ShellDispatcher makes, this will make removing the dependency from Shell much easier.

This commit is contained in:
mark_story 2010-10-23 00:11:31 -04:00
parent 68e176b515
commit cf9166a689
7 changed files with 8 additions and 12 deletions

View file

@ -60,7 +60,7 @@ class BakeShell extends Shell {
public function main() {
if (!is_dir($this->DbConfig->path)) {
if ($this->Project->execute()) {
$this->DbConfig->path = $this->params['working'] . DS . 'config' . DS;
$this->DbConfig->path = APP_PATH . DS . 'config' . DS;
} else {
return false;
}

View file

@ -205,8 +205,8 @@ class Shell extends Object {
$this->out();
$this->out('<info>Welcome to CakePHP v' . Configure::version() . ' Console</info>');
$this->hr();
$this->out('App : '. $this->Dispatch->params['app']);
$this->out('Path: '. $this->Dispatch->params['working']);
$this->out('App : '. APP_DIR);
$this->out('Path: '. APP_PATH);
$this->hr();
}

View file

@ -60,7 +60,7 @@ class DbConfigTask extends Shell {
* @var string
*/
public function initialize() {
$this->path = $this->Dispatch->params['working'] . DS . 'config' . DS;
$this->path = APP_PATH . 'config' . DS;
}
/**

View file

@ -103,7 +103,7 @@ class ExtractTask extends Shell {
if (isset($this->params['paths'])) {
$this->__paths = explode(',', $this->params['paths']);
} else {
$defaultPath = $this->Dispatch->params['working'];
$defaultPath = APP_PATH;
$message = sprintf(__("What is the full path you would like to extract?\nExample: %s\n[Q]uit [D]one"), $this->Dispatch->params['root'] . DS . 'myapp');
while (true) {
$response = $this->in($message, null, $defaultPath);

View file

@ -56,7 +56,7 @@ class FixtureTask extends BakeTask {
*/
public function __construct(&$dispatch, $stdout = null, $stderr = null, $stdin = null) {
parent::__construct($dispatch, $stdout, $stderr, $stdin);
$this->path = $this->Dispatch->params['working'] . DS . 'tests' . DS . 'fixtures' . DS;
$this->path = APP_PATH . 'tests' . DS . 'fixtures' . DS;
}
/**

View file

@ -69,7 +69,7 @@ class DbConfigTaskTest extends CakeTestCase {
array(&$this->Dispatcher, $out, $out, $in)
);
$this->Task->params['working'] = rtrim(APP, DS);
$this->Task->path = APP . 'config' . DS;
$this->Task->databaseClassName = 'TEST_DATABASE_CONFIG';
}
@ -100,7 +100,6 @@ class DbConfigTaskTest extends CakeTestCase {
* @return void
*/
public function testInitialize() {
$this->assertTrue(empty($this->Task->path));
$this->Task->initialize();
$this->assertFalse(empty($this->Task->path));
$this->assertEqual($this->Task->path, APP . 'config' . DS);

View file

@ -85,11 +85,8 @@ class FixtureTaskTest extends CakeTestCase {
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Dispatcher->params['working'] = DS . 'my' . DS . 'path';
$Task = new FixtureTask($this->Dispatcher, $out, $out, $in);
$expected = DS . 'my' . DS . 'path' . DS . 'tests' . DS . 'fixtures' . DS;
$this->assertEqual($Task->path, $expected);
$this->assertEqual($Task->path, APP . 'tests' . DS . 'fixtures' . DS);
}
/**