<commit_before><?php
/**
 * Litus is a project by a group of students from the KU Leuven. The goal is to create
 * various applications to support the IT needs of student unions.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace CommonBundle\Component\Assetic\Filter;

class Less extends \Assetic\Filter\LessFilter
{
    public function __construct()
    {
        exec('/usr/bin/which node', $nodeBin, $returnValue);
        if ($returnValue !== 0) {
            $nodeBin = '/usr/node/bin';
        }



        parent::__construct($nodeBin);
        $this->setCompress(true);
    }
}<commit_msg>Dynamically locate node and npm<commit_after><?php
/**
 * Litus is a project by a group of students from the KU Leuven. The goal is to create
 * various applications to support the IT needs of student unions.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace CommonBundle\Component\Assetic\Filter;

use RuntimeException;

class Less extends \Assetic\Filter\LessFilter
{
    public function __construct()
    {
        exec('/usr/bin/which node', $output, $returnValue);
        if ($returnValue !== 0) {
            throw new RuntimeException('Failed to locate node');
        }
        $nodeBin = array_pop($output);

        exec('/usr/bin/which npm', $output, $returnValue);
        if ($returnValue !== 0) {
            throw new RuntimeException('Failed to locate npm');
        }
        $npmBin = array_pop($output);

        exec($npmBin . ' ' . 'prefix -g', $output, $returnValue);
        if ($returnValue !== 0) {
            throw new RuntimeException('Could not determine npm prefix');
        }
        $npmPrefix = array_pop($output);

        parent::__construct($nodeBin, array($npmPrefix . '/lib/node_modules'));
        $this->setCompress(true);
    }
}
{'fraction_non_alphanumeric': 0.169237182159233, 'fraction_numerical': 0.0016673614005835765, 'mean_word_length': 3.033613445378151, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6099355', 'n_tokens_mistral': 764, 'n_tokens_neox': 744, 'n_words': 214}