diff options
author | Samuel Bernardo <samuelbernardo.mail@gmail.com> | 2018-06-24 23:25:59 +0100 |
---|---|---|
committer | Samuel Bernardo <samuelbernardo.mail@gmail.com> | 2018-06-24 23:25:59 +0100 |
commit | fab8c591587117c50df1247d3ac7d81fe00c10a6 (patch) | |
tree | 2992547a5bf3d9ab2bde03330e0df99f3b522ed5 /eclass | |
parent | update opennebula-5.4.15 with additional compile configurations (diff) | |
download | ssnb-fab8c591587117c50df1247d3ac7d81fe00c10a6.tar.gz ssnb-fab8c591587117c50df1247d3ac7d81fe00c10a6.tar.bz2 ssnb-fab8c591587117c50df1247d3ac7d81fe00c10a6.zip |
add npm-tools.eclass and update opennebula 5.4.15 to use this new eclass
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/npm-tools.eclass | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/eclass/npm-tools.eclass b/eclass/npm-tools.eclass new file mode 100644 index 0000000..6dcc821 --- /dev/null +++ b/eclass/npm-tools.eclass @@ -0,0 +1,45 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: npm-tools.eclass +# @MAINTAINER: +# samuelbernardo@gmail.com +# @BLURB: functions to install project nodejs dependencies +# @DESCRIPTION: +# The npm-tools eclass contains functions to manage nodejs package +# for projects that needs it. +# +# For more details review the following url: +# https://gruntjs.com/getting-started + +if [[ -z ${_NPM_TOOLS_ECLASS} ]]; then +_NPM_TOOLS_ECLASS=1 + +# implicitly inherited eclasses +#case ${EAPI:-0} in +#0|1|2|3|4|5|6) +# inherit eutils +# ;; +#esac + +# @FUNCTION: npm_install +# @USAGE: [project dir] +# @DESCRIPTION: +# Run npm install in the provided project directory. +# If no directory is provided it will run on current path. +case ${EAPI:-0} in +5|6) + npm_install() { + local dir="$1" + if [[ -z "${dir}" ]] ; then + $(which npm) install + else + pushd ${dir} + $(which npm) install + popd + fi + } + ;; +esac + +fi |