* [gentoo-commits] dev/neurogeek:master commit in: eclass/
@ 2013-07-10 12:27 Jesus Rivero
0 siblings, 0 replies; 5+ messages in thread
From: Jesus Rivero @ 2013-07-10 12:27 UTC (permalink / raw
To: gentoo-commits
commit: 61edb1e2b0cf09ea22cd19b6defb10dcb1ea0432
Author: Jesus Rivero <jesus.riveroa <AT> gmail <DOT> com>
AuthorDate: Wed Jul 10 12:28:30 2013 +0000
Commit: Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Wed Jul 10 12:28:30 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/neurogeek.git;a=commit;h=61edb1e2
Adding npm.eclass
---
eclass/npm.eclass | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 103 insertions(+)
diff --git a/eclass/npm.eclass b/eclass/npm.eclass
new file mode 100644
index 0000000..d77b9ba
--- /dev/null
+++ b/eclass/npm.eclass
@@ -0,0 +1,103 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: npm.eclass
+# @MAINTAINER:
+# Jesus Rivero <neurogeek@gentoo.org>
+# @BLURB: Eclass for NodeJS packages available through the npm registry.
+# @DESCRIPTION:
+# This eclass contains various functions that may be useful when
+# dealing with packages from the npm registry, for NodeJS.
+# Requires EAPI=2 or later.
+
+case ${EAPI} in
+ 2|3|4|5) : ;;
+ *) die "npm.eclass: unsupported EAPI=${EAPI:-0}" ;;
+esac
+
+inherit multilib
+
+# @ECLASS-VARIABLE: NPM_MODULE
+# @DESCRIPTION:
+# Name of the resulting NodeJS/npm module.
+# The Default value for NPM_MODULE is ${PN}
+#
+# Example: NPM_MODULE="${MY_PN}"
+NPM_MODULE="${PN}"
+
+# @ECLASS-VARIABLE: NPM_FILES
+# @INTERNAL
+# @DESCRIPTION:
+# Files and directories that usually come in a standard
+# NodeJS/npm module.
+NPM_FILES="lib package.json index.js"
+
+# @ECLASS-VARIABLE: NPM_DOCS
+# @INTERNAL
+# @DESCRIPTION:
+# Document files that usually come in a standard
+# NodeJS/npm module.
+NPM_DOCS="README* LICENSE HISTORY*"
+
+# @ECLASS-VARIABLE: NPM_EXTRA_FILES
+# @DESCRIPTION:
+# If additional dist files are present in the NodeJS/npm module
+# that are not listed in NPM_FILES, then this is the place to put them in.
+# Can be either files, or directories.
+# Example: NPM_EXTRA_FILES="rigger.js modules"
+
+# @ECLASS-VARIABLE: NPM_EXTRA_DOCS
+# @DESCRIPTION:
+# Variable for additional document files that are not listed
+# in NPM_DOCS
+# Example: NPM_EXTRA_DOCS="docs index.html"
+
+HOMEPAGE="https://www.npmjs.org/package/${PN}"
+SRC_URI="http://registry.npmjs.org/${PN}/-/${P}.tgz"
+
+# @FUNCTION: npm-src_unpack
+# @DESCRIPTION:
+# Default src_unpack function for NodeJS/npm packages. This funtions
+# unpacks the source code, then renames the 'package' dir to $S
+
+npm_src_unpack() {
+ unpack "${A}"
+ mv "${WORKDIR}/package" ${S}
+}
+
+# @FUNCTION: npm-src_compile
+# @DESCRIPTION:
+# This function does nothing.
+
+npm_src_compile() {
+ true
+}
+
+# @FUNCTION: npm-src_install
+# @DESCRIPTION:
+# This function installs the NodeJS/npm module to an appropriate location,
+# also taking care of NPM_FILES, NPM_EXTRA_FILES, NPM_DOCS and NPM_EXTRA_DOCS
+
+npm_src_install() {
+ local node_modules="${D}/usr/$(get_libdir)/node_modules/${NPM_MODULE}"
+ mkdir -p ${node_modules} || die "Could not create DEST folder"
+
+ # These are basically the 'standard' files in an npm package
+ # We'll handle additional files in NPM_EXTRA_FILES
+ for f in "${NPM_FILES} ${NPM_EXTRA_FILES}"
+ do
+ if [[ -e "${S}/$f" ]]; then
+ cp -r "${S}/$f" ${node_modules}
+ fi
+ done
+
+ for f in "${NPM_DOCS} ${NPM_EXTRA_DOCS}"
+ do
+ if [[ -e "${S}/$f" ]]; then
+ dodoc -r "${S}/$f"
+ fi
+ done
+}
+
+EXPORT_FUNCTIONS src_unpack src_compile src_install
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] dev/neurogeek:master commit in: eclass/
@ 2013-07-10 14:35 Jesus Rivero
0 siblings, 0 replies; 5+ messages in thread
From: Jesus Rivero @ 2013-07-10 14:35 UTC (permalink / raw
To: gentoo-commits
commit: a6f4db7e7bbff2a525c344ea8994d6bbc99d6c1a
Author: Jesus Rivero <jesus.riveroa <AT> gmail <DOT> com>
AuthorDate: Wed Jul 10 14:36:28 2013 +0000
Commit: Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Wed Jul 10 14:36:28 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/neurogeek.git;a=commit;h=a6f4db7e
Use whitespace instead of tabs
---
eclass/npm.eclass | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/eclass/npm.eclass b/eclass/npm.eclass
index 745242b..2258c44 100644
--- a/eclass/npm.eclass
+++ b/eclass/npm.eclass
@@ -12,8 +12,8 @@
# Requires EAPI=2 or later.
case ${EAPI} in
- 2|3|4|5) : ;;
- *) die "npm.eclass: unsupported EAPI=${EAPI:-0}" ;;
+ 2|3|4|5) : ;;
+ *) die "npm.eclass: unsupported EAPI=${EAPI:-0}" ;;
esac
inherit multilib
@@ -62,8 +62,8 @@ SRC_URI="http://registry.npmjs.org/${PN}/-/${P}.tgz"
# unpacks the source code, then renames the 'package' dir to $S
npm_src_unpack() {
- unpack "${A}"
- mv "${WORKDIR}/package" ${S}
+ unpack "${A}"
+ mv "${WORKDIR}/package" ${S}
}
# @FUNCTION: npm-src_compile
@@ -71,7 +71,7 @@ npm_src_unpack() {
# This function does nothing.
npm_src_compile() {
- true
+ true
}
# @FUNCTION: npm-src_install
@@ -80,28 +80,28 @@ npm_src_compile() {
# also taking care of NPM_FILES, NPM_EXTRA_FILES, NPM_DOCS and NPM_EXTRA_DOCS
npm_src_install() {
- local npm_files="${NPM_FILES} ${NPM_EXTRA_FILES}"
- local node_modules="${D}/usr/$(get_libdir)/node_modules/${NPM_MODULE}"
+ local npm_files="${NPM_FILES} ${NPM_EXTRA_FILES}"
+ local node_modules="${D}/usr/$(get_libdir)/node_modules/${NPM_MODULE}"
- mkdir -p ${node_modules} || die "Could not create DEST folder"
+ mkdir -p ${node_modules} || die "Could not create DEST folder"
- for f in ${npm_files}
- do
+ for f in ${npm_files}
+ do
if [[ -e "${S}/$f" ]]; then
cp -r "${S}/$f" ${node_modules}
fi
done
-
- if use doc; then
- local npm_docs="${NPM_DOCS} ${NPM_EXTRA_DOCS}"
-
- for f in $npm_docs
- do
- if [[ -e "${S}/$f" ]]; then
- dodoc -r "${S}/$f"
- fi
- done
- fi
+
+ if use doc; then
+ local npm_docs="${NPM_DOCS} ${NPM_EXTRA_DOCS}"
+
+ for f in $npm_docs
+ do
+ if [[ -e "${S}/$f" ]]; then
+ dodoc -r "${S}/$f"
+ fi
+ done
+ fi
}
EXPORT_FUNCTIONS src_unpack src_compile src_install
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] dev/neurogeek:master commit in: eclass/
@ 2013-07-10 14:50 Jesus Rivero
0 siblings, 0 replies; 5+ messages in thread
From: Jesus Rivero @ 2013-07-10 14:50 UTC (permalink / raw
To: gentoo-commits
commit: c1010c6d98fe9fde4b9219c989f126366f3f7d7c
Author: Jesus Rivero <jesus.riveroa <AT> gmail <DOT> com>
AuthorDate: Wed Jul 10 14:50:21 2013 +0000
Commit: Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Wed Jul 10 14:50:21 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/neurogeek.git;a=commit;h=c1010c6d
Changed 'use doc' for 'has doc $USE'
---
eclass/npm.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/npm.eclass b/eclass/npm.eclass
index 2258c44..65b7447 100644
--- a/eclass/npm.eclass
+++ b/eclass/npm.eclass
@@ -92,7 +92,7 @@ npm_src_install() {
fi
done
- if use doc; then
+ if has doc ${USE}; then
local npm_docs="${NPM_DOCS} ${NPM_EXTRA_DOCS}"
for f in $npm_docs
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] dev/neurogeek:master commit in: eclass/
@ 2013-08-23 18:38 Jesus Rivero
0 siblings, 0 replies; 5+ messages in thread
From: Jesus Rivero @ 2013-08-23 18:38 UTC (permalink / raw
To: gentoo-commits
commit: 83fa26f430ee23c7b11a6c18dfa866692996726f
Author: Jesus Rivero <jesus.riveroa <AT> gmail <DOT> com>
AuthorDate: Fri Aug 23 18:37:31 2013 +0000
Commit: Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Fri Aug 23 18:37:31 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/neurogeek.git;a=commit;h=83fa26f4
Tweaks to npm.eclass
---
eclass/npm.eclass | 47 ++++++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/eclass/npm.eclass b/eclass/npm.eclass
index 65b7447..b6a2cde 100644
--- a/eclass/npm.eclass
+++ b/eclass/npm.eclass
@@ -7,8 +7,8 @@
# Jesus Rivero <neurogeek@gentoo.org>
# @BLURB: Eclass for NodeJS packages available through the npm registry.
# @DESCRIPTION:
-# This eclass contains various functions that may be useful when
-# dealing with packages from the npm registry, for NodeJS.
+# This eclass contains various functions that may be useful when dealing with
+# packages from the npm registry, for NodeJS.
# Requires EAPI=2 or later.
case ${EAPI} in
@@ -29,37 +29,30 @@ NPM_MODULE="${PN}"
# @ECLASS-VARIABLE: NPM_FILES
# @INTERNAL
# @DESCRIPTION:
-# Files and directories that usually come in a standard
-# NodeJS/npm module.
-NPM_FILES="lib package.json index.js"
+# Files and directories that usually come in a standard NodeJS/npm module.
+NPM_FILES="index.js lib package.json ${PN}.js"
# @ECLASS-VARIABLE: NPM_DOCS
-# @INTERNAL
# @DESCRIPTION:
-# Document files that usually come in a standard
-# NodeJS/npm module.
-NPM_DOCS="README* LICENSE HISTORY*"
+# Document files that come in a NodeJS/npm module, outside of the usual docs
+# list of README*, ChangeLog AUTHORS* etc. These are only installed if 'doc' is
+# in ${USE}
+# NPM_DOCS="README* LICENSE HISTORY*"
# @ECLASS-VARIABLE: NPM_EXTRA_FILES
# @DESCRIPTION:
-# If additional dist files are present in the NodeJS/npm module
-# that are not listed in NPM_FILES, then this is the place to put them in.
+# If additional dist files are present in the NodeJS/npm module that are not
+# listed in NPM_FILES, then this is the place to put them in.
# Can be either files, or directories.
# Example: NPM_EXTRA_FILES="rigger.js modules"
-# @ECLASS-VARIABLE: NPM_EXTRA_DOCS
-# @DESCRIPTION:
-# Variable for additional document files that are not listed
-# in NPM_DOCS
-# Example: NPM_EXTRA_DOCS="docs index.html"
-
HOMEPAGE="https://www.npmjs.org/package/${PN}"
SRC_URI="http://registry.npmjs.org/${PN}/-/${P}.tgz"
# @FUNCTION: npm-src_unpack
# @DESCRIPTION:
-# Default src_unpack function for NodeJS/npm packages. This funtions
-# unpacks the source code, then renames the 'package' dir to $S
+# Default src_unpack function for NodeJS/npm packages. This funtions unpacks
+# the source code, then renames the 'package' dir to ${S}.
npm_src_unpack() {
unpack "${A}"
@@ -69,15 +62,14 @@ npm_src_unpack() {
# @FUNCTION: npm-src_compile
# @DESCRIPTION:
# This function does nothing.
-
npm_src_compile() {
true
}
# @FUNCTION: npm-src_install
# @DESCRIPTION:
-# This function installs the NodeJS/npm module to an appropriate location,
-# also taking care of NPM_FILES, NPM_EXTRA_FILES, NPM_DOCS and NPM_EXTRA_DOCS
+# This function installs the NodeJS/npm module to an appropriate location, also
+# taking care of NPM_FILES, NPM_EXTRA_FILES, NPM_DOCS
npm_src_install() {
local npm_files="${NPM_FILES} ${NPM_EXTRA_FILES}"
@@ -91,9 +83,18 @@ npm_src_install() {
cp -r "${S}/$f" ${node_modules}
fi
done
+
+ # Install docs usually found in NodeJS/NPM packages.
+ local f
+ for f in README* HISTORY* ChangeLog AUTHORS NEWS TODO CHANGES \
+ THANKS BUGS FAQ CREDITS CHANGELOG*; do
+ if [[ -s ${f} ]]; then
+ dodoc "${f}"
+ fi
+ done
if has doc ${USE}; then
- local npm_docs="${NPM_DOCS} ${NPM_EXTRA_DOCS}"
+ local npm_docs="${NPM_DOCS}"
for f in $npm_docs
do
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] dev/neurogeek:master commit in: eclass/
@ 2013-08-23 21:33 Jesus Rivero
0 siblings, 0 replies; 5+ messages in thread
From: Jesus Rivero @ 2013-08-23 21:33 UTC (permalink / raw
To: gentoo-commits
commit: a07b459620a4aa05b667fc2de0c6df13e1d4eb8c
Author: Jesus Rivero <jesus.riveroa <AT> gmail <DOT> com>
AuthorDate: Fri Aug 23 21:32:35 2013 +0000
Commit: Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Fri Aug 23 21:32:35 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/neurogeek.git;a=commit;h=a07b4596
Don't override NPM_MODULE if it was already defined
---
eclass/npm.eclass | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/eclass/npm.eclass b/eclass/npm.eclass
index b6a2cde..e4a064e 100644
--- a/eclass/npm.eclass
+++ b/eclass/npm.eclass
@@ -24,13 +24,15 @@ inherit multilib
# The Default value for NPM_MODULE is ${PN}
#
# Example: NPM_MODULE="${MY_PN}"
-NPM_MODULE="${PN}"
+if [[ -z $NPM_MODULE ]]; then
+ NPM_MODULE="${PN}"
+fi
# @ECLASS-VARIABLE: NPM_FILES
# @INTERNAL
# @DESCRIPTION:
# Files and directories that usually come in a standard NodeJS/npm module.
-NPM_FILES="index.js lib package.json ${PN}.js"
+NPM_FILES="index.js lib package.json ${NPM_MODULE}.js"
# @ECLASS-VARIABLE: NPM_DOCS
# @DESCRIPTION:
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-23 21:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-10 14:50 [gentoo-commits] dev/neurogeek:master commit in: eclass/ Jesus Rivero
-- strict thread matches above, loose matches on Subject: below --
2013-08-23 21:33 Jesus Rivero
2013-08-23 18:38 Jesus Rivero
2013-07-10 14:35 Jesus Rivero
2013-07-10 12:27 Jesus Rivero
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox