Skip to content

Commit

Permalink
Starting to remove Dispatch->params in favor of the constants ShellDi…
Browse files Browse the repository at this point in the history
…spatcher makes, this will make removing the dependency from Shell much easier.
  • Loading branch information
markstory committed Oct 23, 2010
1 parent 68e176b commit cf9166a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cake/console/shells/bake.php
Expand Up @@ -60,7 +60,7 @@ public function startup() {
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;
}
Expand Down
4 changes: 2 additions & 2 deletions cake/console/shells/shell.php
Expand Up @@ -205,8 +205,8 @@ protected function _welcome() {
$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();
}

Expand Down
2 changes: 1 addition & 1 deletion cake/console/shells/tasks/db_config.php
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion cake/console/shells/tasks/extract.php
Expand Up @@ -103,7 +103,7 @@ function execute() {
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);
Expand Down
2 changes: 1 addition & 1 deletion cake/console/shells/tasks/fixture.php
Expand Up @@ -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;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions cake/tests/cases/console/shells/tasks/db_config.test.php
Expand Up @@ -69,7 +69,7 @@ public function setUp() {
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';
}

Expand Down Expand Up @@ -100,7 +100,6 @@ public function testGetConfig() {
* @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);
Expand Down
5 changes: 1 addition & 4 deletions cake/tests/cases/console/shells/tasks/fixture.test.php
Expand Up @@ -85,11 +85,8 @@ public function testConstruct() {
$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);
}

/**
Expand Down

0 comments on commit cf9166a

Please sign in to comment.