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
89484b77
Commit
89484b77
authored
Aug 13, 2013
by
zeke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch all available versions from nodejs.org
parent
998af955
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
21 deletions
+44
-21
common.sh
bin/common.sh
+31
-5
compile
bin/compile
+13
-16
No files found.
bin/common.sh
View file @
89484b77
...
...
@@ -6,11 +6,37 @@ set -e
# debug
set
-x
function
tar_download
()
{
url
=
"
$1
"
location
=
"
$2
"
mkdir
-p
$location
curl
$url
-s
-o
- |
tar
xzf -
-C
$location
download_node
()
{
version
=
"
$1
"
status
"Downloading node
$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
status
"Adding node and npm to
\$
PATH"
chmod
+x
$build_dir
/node/bin/
*
PATH
=
$PATH
:
$build_dir
/node/bin
}
query_stable_version
()
{
curl
-s
http://nodejs.org/dist/
\
| egrep
-o
'[0-9]+\.[0-9]*[02468]\.[0-9]+'
\
|
sort
-u
-k
1,1n
-k
2,2n
-k
3,3n
-t
.
\
|
tail
-n1
}
query_latest_version
()
{
curl
-s
http://nodejs.org/dist/
\
| egrep
-o
'[0-9]+\.[0-9]+\.[0-9]+'
\
|
sort
-u
-k
1,1n
-k
2,2n
-k
3,3n
-t
.
\
|
tail
-n1
}
all_versions
()
{
curl
-s
http://nodejs.org/dist/
\
| egrep
-o
'[0-9]+\.[0-9]+\.[0-9]+'
\
|
sort
-u
-k
1,1n
-k
2,2n
-k
3,3n
-t
.
}
function
error
()
{
...
...
bin/compile
View file @
89484b77
...
...
@@ -3,34 +3,31 @@
build_dir
=
$1
cache_dir
=
$2
lp_dir
=
$(
cd
$(
dirname
$0
)
;
cd
..
;
pwd
)
default_version
=
"0.10.15"
node_url
=
"http://s3pository.heroku.com/node/v
$default_version
/node-v
$default_version
-linux-x64.tar.gz"
stable_version
=
"0.10.15"
source
$lp_dir
/bin/common.sh
# Output debug info on exit
trap
cat_npm_debug_log EXIT
status
"Downloading node v
$default_version
"
tar_download
$node_url
$build_dir
download_node
$stable_version
status
"Adding node and npm to
\$
PATH"
mv
$build_dir
/node-v
$default_version
-linux-x64
$build_dir
/node
chmod
+x
$build_dir
/node/bin/
*
PATH
=
$PATH
:
$build_dir
/node/bin
# cd $build_dir
cd
$build_dir
#
Is a node version present in package.json?
desired_version
=
$(
cat
$build_dir
/package.json | node
$lp_dir
/vendor/json engines.node 2>/dev/null
)
echo
"desired_version:
$desired_version
"
if
[
"
$desired_version
"
!=
""
]
;
then
default_satisfies
=
$(
node
$lp_dir
/vendor/semver/bin/semver
$default_version
-r
"
$desired_version
"
)
echo
"default_satisfies:
$default_satisfies
"
# Is a node version specified in package.json?
requested_version
=
$(
cat
$build_dir
/package.json | node
$lp_dir
/vendor/json engines.node 2>/dev/null
)
#
echo "requested_version: $requested_version"
if
test
$requested_version
;
then
default_satisfies
=
$(
node
$lp_dir
/vendor/semver/bin/semver
$stable_version
-r
"
$requested_version
"
)
if
!
test
$default_satisfies
;
then
download_node
$requested_version
fi
fi
status
"Installing dependencies with npm"
npm prune
npm
install
--production
npm rebuild
echo
"Dependencies installed"
| indent
status
"Building runtime environment"
...
...
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