Skip to content

Instantly share code, notes, and snippets.

@daFish
Created November 13, 2012 13:00
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
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