Install npm package locally

This commit is contained in:
Nicolas Le Goff
2013-08-08 18:19:54 +02:00
parent caae97ef5a
commit f6e9e227f8
7 changed files with 51 additions and 8 deletions

1
.gitignore vendored
View File

@@ -10,6 +10,7 @@
.DS_Store
/vendor
/plugins
/node_modules
composer.phar
behat.yml
/datas

View File

@@ -10,7 +10,7 @@ before_script:
- cp -f hudson/_GV.php config/
- node --version
- npm --version
- npm install bower-canary mocha-phantomjs@">=2.0 <3.0" recess@">=1.1.0 <1.1.7" uglify-js -g
- npm install
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
- sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then pecl install redis; fi;'

View File

@@ -92,6 +92,7 @@ $finder
->name('sinon')
->name('sinon-chai')
->name('js-fixtures')
->name('node_modules')
->ignoreDotFiles(false)
->ignoreVCS(false)
->in(__DIR__);

View File

@@ -40,7 +40,7 @@ class BowerInstall extends Command
if (!version_compare('1.0.0-alpha.1', $version, '<=')) {
throw new RuntimeException(sprintf(
'Bower version 1.0.0-alpha.1 is required (version %s provided), please install bower-canary : `npm install -g bower-canary`', $version
'Bower version 1.0.0-alpha.1 is required (version %s provided), please install bower-canary : `npm install -g bower-canary or run npm install from root directory`', $version
));
}

View File

@@ -29,15 +29,21 @@ class CLIDriversServiceProvider implements ServiceProviderInterface
});
$app['driver.binary-finder'] = $app->protect(function ($name, $configName) use ($app) {
$extraDirs = array();
if (is_dir($app['root.path'] . '/node_modules')) {
$extraDirs[] = $app['root.path'] . '/node_modules/.bin';
}
if (!$app['phraseanet.configuration']->isSetup()) {
return $app['executable-finder']->find($name);
return $app['executable-finder']->find($name, null, $extraDirs);
}
if (isset($app['phraseanet.configuration']['binaries'][$configName])) {
return $app['phraseanet.configuration']['binaries'][$configName];
}
return $app['executable-finder']->find($name);
return $app['executable-finder']->find($name, null, $extraDirs);
});
$app['driver.bower'] = $app->share(function (Application $app) {

10
package.json Normal file
View File

@@ -0,0 +1,10 @@
{
"name": "phraseanet",
"version": "3.9.0",
"devDependencies": {
"bower-canary": "latest",
"mocha-phantomjs": ">=2.0 <3.0",
"recess": ">=1.1.0 <1.1.7",
"uglify-js": "latest"
}
}

View File

@@ -2,12 +2,37 @@
BASEDIR=$(dirname $0)
ROOTDIR="$BASEDIR/../.."
PHANTOMJS_BIN=""
MOCHA_PHANTOMJS_BIN=""
if type "phantomjs" > /dev/null; then
PHANTOMJS_BIN="phantomjs"
elif type "$ROOTDIR/node_modules/.bin/phantomjs" > /dev/null; then
PHANTOMJS_BIN="$ROOTDIR/node_modules/.bin/phantomjs"
fi
if type "mocha-phantomjs" > /dev/null; then
MOCHA_PHANTOMJS_BIN="mocha-phantomjs"
elif type "$ROOTDIR/node_modules/.bin/mocha-phantomjs" > /dev/null; then
MOCHA_PHANTOMJS_BIN="$ROOTDIR/node_modules/.bin/mocha-phantomjs"
fi
if [ -z "$PHANTOMJS_BIN" ]; then
echo "phantomjs is required to run JS tests, see https://npmjs.org/package/phantomjs"
exit 1
fi
if [ -z "$MOCHA_PHANTOMJS_BIN" ]; then
echo "mocha-phantomjs is required to run JS tests, see https://npmjs.org/package/mocha-phantomjs"
exit 1
fi
# run qunit tests
phantomjs "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Upload.js.html"
phantomjs "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Edit.js.html"
phantomjs "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Selection.js.html"
$PHANTOMJS_BIN "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Upload.js.html"
$PHANTOMJS_BIN "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Edit.js.html"
$PHANTOMJS_BIN "$ROOTDIR/www/assets/qunit/addons/phantomjs/runner.js" "$ROOTDIR/www/include/js/tests/jquery.Selection.js.html"
# run backbone tests
mocha-phantomjs "$ROOTDIR/www/scripts/tests/index.html"
$MOCHA_PHANTOMJS_BIN "$ROOTDIR/www/scripts/tests/index.html"