Skip to content

Instantly share code, notes, and snippets.

@daFish
Created November 13, 2012 13:00
Show Gist options
  • Save daFish/4065648 to your computer and use it in GitHub Desktop.
Save daFish/4065648 to your computer and use it in GitHub Desktop.
Run 'bower install' with composer
{
"scripts": {
"post-install-cmd": [
// put this before installAssets
"Fmdb\\CoreBundle\\Composer\\ScriptHandler::installBowerAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
],
"post-update-cmd": [
// put this before installAssets
"Fmdb\\CoreBundle\\Composer\\ScriptHandler::installBowerAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
]
},
}
namespace Fmdb\CoreBundle\Composer;
use Sensio\Bundle\DistributionBundle\Composer\ScriptHandler as BaseScriptHandler;
use Symfony\Component\ClassLoader\ClassCollectionLoader;
use Symfony\Component\Process\Process;
class ScriptHandler extends BaseScriptHandler
{
public static function installBowerAssets($event)
{
$process = new Process('bower install', null, null, null, 300);
$process->run(function ($type, $buffer) { echo $buffer; });
if (!$process->isSuccessful()) {
throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command.', escapeshellarg($cmd)));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment