Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-nodejs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-nodejs
Commits
6a5eec7d
Commit
6a5eec7d
authored
Nov 30, 2011
by
David Dollar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow usage of multiple nodejs versions
parent
0146af87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
compile
bin/compile
+14
-17
No files found.
bin/compile
View file @
6a5eec7d
...
...
@@ -4,6 +4,11 @@
# fail fast
set
-e
function
error
()
{
echo
" !
$*
"
exit
1
}
function
mktmpdir
()
{
dir
=
$(
mktemp
-t
node-
$1
-XXXX
)
rm
-rf
$dir
...
...
@@ -33,7 +38,14 @@ run_npm() {
unset
GIT_DIR
function
manifest_versions
()
{
curl
"http://
${
S3_BUCKET
}
.s3.amazonaws.com/manifest.
${
1
}
"
-s
-o
-
curl
"http://
${
S3_BUCKET
}
.s3.amazonaws.com/manifest.
${
1
}
"
-s
-o
- |
tr
-s
'\n'
' '
}
function
resolve_versions
()
{
args
=
""
for
version
in
$1
;
do
args
=
"
${
args
}
-v
\"
${
version
}
\"
"
;
done
for
version
in
$2
;
do
args
=
"
${
args
}
-r
\"
${
version
}
\"
"
;
done
eval
vendor/node-semver/bin/semver
${
args
}
|
tail
-r
|
head
-n1
}
# config
...
...
@@ -49,14 +61,6 @@ LP_DIR=`cd $(dirname $0); cd ..; pwd`
CACHE_STORE_DIR
=
"
$CACHE_DIR
/node_modules/
$NPM_VERSION
"
CACHE_TARGET_DIR
=
"
$BUILD_DIR
/node_modules"
# bootstrap node
NODE_PACKAGE
=
"http://
${
S3_BUCKET
}
.s3.amazonaws.com/nodejs-
${
DEFAULT_NODE_VERSION
}
.tgz"
VENDORED_NODE
=
"
$(
mktmpdir node
)
"
echo
"-----> Bootstraping Node.js"
mkdir
-p
$VENDORED_NODE
&&
curl
$NODE_PACKAGE
-s
-o
- |
tar
xzf -
-C
$VENDORED_NODE
OLDPATH
=
"
$PATH
"
PATH
=
"
$VENDORED_NODE
/bin:
$PATH
"
# determine available versions
NODEJS_VERSIONS
=
$(
manifest_versions
"nodejs"
)
NPM_VERSIONS
=
$(
manifest_versions
"npm"
)
...
...
@@ -84,7 +88,6 @@ else
NODE_VERSION
=
${
RESOLVED_NODE
}
fi
fi
echo
"-----> Using Node.js version:
${
NODE_VERSION
}
"
# resolve npm version
...
...
@@ -94,16 +97,13 @@ else
RESOLVED_NPM
=
$(
resolve_versions
"
${
NPM_VERSIONS
}
"
"
${
REQUESTED_NPM_VERSION
}
"
)
if
[
"
${
RESOLVED_NPM
}
"
==
""
]
;
then
error
"Requested
npm
version:
${
REQUESTED_NPM_VERSION
}
does not match available versions:
${
NPMJS_VERSIONS
}
"
error
"Requested
Node.js
version:
${
REQUESTED_NPM_VERSION
}
does not match available versions:
${
NPMJS_VERSIONS
}
"
else
NPM_VERSION
=
${
RESOLVED_NPM
}
fi
fi
echo
"-----> Using npm version:
${
NPM_VERSION
}
"
# reset path to undo bootstrapped node
PATH
=
"
$OLDPATH
"
# s3 packages
NODE_PACKAGE
=
"http://
${
S3_BUCKET
}
.s3.amazonaws.com/nodejs-
${
NODE_VERSION
}
.tgz"
NPM_PACKAGE
=
"http://
${
S3_BUCKET
}
.s3.amazonaws.com/npm-
${
NPM_VERSION
}
.tgz"
...
...
@@ -114,9 +114,6 @@ VENDORED_NODE="$(mktmpdir node)"
VENDORED_NPM
=
"
$(
mktmpdir npm
)
"
VENDORED_SCONS
=
"
$(
mktmpdir scons
)
"
# determine node version
echo
"available versions of node:
$(
manifest_versions
"nodejs"
)
"
# download and unpack packages
echo
"-----> Fetching Node.js binaries"
mkdir
-p
$VENDORED_NODE
&&
curl
$NODE_PACKAGE
-s
-o
- |
tar
xzf -
-C
$VENDORED_NODE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment