Commit 50926122 by Klimov Paul

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

parent f4cb1e4a
......@@ -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;
......
......@@ -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";
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment