Browse Source

Method "console\controllers\AssetController::actionTemplate()" has been updated to be more verbose.

tags/2.0.0-beta
Klimov Paul 12 years ago
parent
commit
5092612217
  1. 1
      tests/unit/framework/console/controllers/AssetControllerTest.php
  2. 16
      yii/console/controllers/AssetController.php

1
tests/unit/framework/console/controllers/AssetControllerTest.php

@ -55,6 +55,7 @@ class AssetControllerTest extends TestCase
{
$module = $this->getMock('yii\\base\\Module', array('fake'), array('console'));
$assetController = new AssetController('asset', $module);
$assetController->interactive = false;
$assetController->jsCompressor = 'cp {from} {to}';
$assetController->cssCompressor = 'cp {from} {to}';
return $assetController;

16
yii/console/controllers/AssetController.php

@ -322,6 +322,10 @@ EOD
file_put_contents($tmpFile, $content);
}
/**
* Creates template of configuration file for [[actionCompress]].
* @param string $configFile output file name.
*/
public function actionTemplate($configFile)
{
$template = <<<EOD
@ -348,6 +352,16 @@ return array(
),
);
EOD;
file_put_contents($configFile, $template);
if (file_exists($configFile)) {
if (!$this->confirm("File '{$configFile}' already exists. Do you wish to overwrite it?")) {
return;
}
}
$bytesWritten = file_put_contents($configFile, $template);
if ($bytesWritten<=0) {
echo "Error: unable to write file '{$configFile}'!\n\n";
} else {
echo "Configuration file template created at '{$configFile}'.\n\n";
}
}
}

Loading…
Cancel
Save