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
5f0305ef
Commit
5f0305ef
authored
Sep 12, 2013
by
zeke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify requested version detection, move node and npm binaries to /app/vendor
parent
e1cfe21e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
12 deletions
+10
-12
common.sh
bin/common.sh
+4
-4
compile
bin/compile
+5
-7
test
bin/test
+1
-1
No files found.
bin/common.sh
View file @
5f0305ef
...
...
@@ -8,12 +8,12 @@ set -e
download_and_install_node
()
{
version
=
"
$1
"
status
"Downloading and installing node v
$version
"
node_url
=
"http://s3pository.heroku.com/node/v
$version
/node-v
$version
-linux-x64.tar.gz"
curl
$node_url
-s
-o
- |
tar
xzf -
-C
$build_dir
mv
$build_dir
/node-v
$version
-linux-x64
$build_dir
/node
chmod
+x
$build_dir
/node/bin/
*
PATH
=
$PATH
:
$build_dir
/node/bin
mkdir
-p
$build_dir
/vendor
mv
$build_dir
/node-v
$version
-linux-x64
$build_dir
/vendor/node
chmod
+x
$build_dir
/vendor/node/bin/
*
PATH
=
$PATH
:
$build_dir
/vendor/node/bin
}
query_stable_version
()
{
...
...
bin/compile
View file @
5f0305ef
...
...
@@ -12,15 +12,12 @@ source $bp_dir/bin/common.sh
# Bootstrap the build process with latest stable version of node
# We'll use it to parse package.json and do semver detection
status
"Bootstrapping node v
$version
"
download_and_install_node
$stable_version
# Is a node version specified in package.json?
determine_requested_version
()
{
# https://github.com/trentm/json
v
=
$(
cat
$build_dir
/package.json | node
$bp_dir
/vendor/json engines.node 2>/dev/null
)
if
[
$?
==
0
]
;
then
echo
$v
;
fi
}
requested_version
=
$(
determine_requested_version
)
# https://github.com/trentm/json
requested_version
=
$(
cat
$build_dir
/package.json |
$bp_dir
/vendor/json engines.node
)
# Give a warning if engines.node is unspecified
if
!
test
$requested_version
;
then
...
...
@@ -52,6 +49,7 @@ else
node_version
=
$(
echo
$evaluated_versions
|
tail
-n
1
)
if
test
$node_version
;
then
status
"Downloading and installing node v
$version
"
download_and_install_node
$node_version
else
error
"node
${
requested_version
}
not found among available versions on nodejs.org/dist"
...
...
@@ -92,4 +90,4 @@ fi
# Update the PATH
status
"Building runtime environment"
mkdir
-p
$build_dir
/.profile.d
echo
"export PATH=
\"\$
HOME/node/bin:
$HOME
/bin:
\$
HOME/node_modules/.bin:
\$
PATH
\"
"
>
$build_dir
/.profile.d/nodejs.sh
echo
"export PATH=
\"\$
HOME/
vendor/
node/bin:
$HOME
/bin:
\$
HOME/node_modules/.bin:
\$
PATH
\"
"
>
$build_dir
/.profile.d/nodejs.sh
bin/test
View file @
5f0305ef
...
...
@@ -47,7 +47,7 @@ testPackageJsonWithInvalidVersion() {
testProfileCreated
()
{
compile
"package-json-stable-version"
assertCaptured
"Building runtime environment"
assertFile
"export PATH=
\"\$
HOME/node/bin:
$HOME
/bin:
\$
HOME/node_modules/.bin:
\$
PATH
\"
"
".profile.d/nodejs.sh"
assertFile
"export PATH=
\"\$
HOME/
vendor/
node/bin:
$HOME
/bin:
\$
HOME/node_modules/.bin:
\$
PATH
\"
"
".profile.d/nodejs.sh"
assertCapturedSuccess
}
...
...
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