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
741800c6
Commit
741800c6
authored
Aug 09, 2013
by
zeke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch node from s3pository
parent
aab11178
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
55 deletions
+35
-55
compile
bin/compile
+17
-55
helpers.sh
support/helpers.sh
+18
-0
No files found.
bin/compile
View file @
741800c6
#!/usr/bin/env bash
set
-e
# fail fast
# set -x # debug
source
support/helpers.sh
BUILD_DIR
=
$1
CACHE_DIR
=
$2
NODE_VERSION
=
'0.10.15'
NODE_URL
=
"http://s3pository.heroku.com/node/v
$NODE_VERSION
/node-v
$NODE_VERSION
-linux-x64.tar.gz"
source
support/helpers.sh
# download latest stable version of node
# detect desired node version in package.json using semver
# if !desired
# (cached) ? cached : latest-stable
# else
# (latest-stable satisfies desired) ? latest-stable : download
# if desired and cached are absent, use latest
# if desired is absent and cache is present, use cached
# if desired is ">" and differs from cached and latest-stable, download
# if desired is specific and differs from cached and latest-stable, download
semver.satisfies
(
'0.10.15'
,
'>=0.10.x'
)
package
=
"http://s3pository.heroku.com/
$engine
-
$version
.tgz"
curl
$package
-s
-o
- |
tar
xzf -
-C
$location
function
cat_npm_debug_log
()
{
if
[
-f
$BUILD_DIR
/npm-debug.log
]
;
then
cat
$BUILD_DIR
/npm-debug.log
fi
}
trap
cat_npm_debug_log EXIT
echo
"-----> Resolving engine versions"
NODE_VERSION
=
$(
package_resolve_version
"node"
)
echo
"Using node version:
${
NODE_VERSION
}
"
| indent
# vendor directories
VENDORED_NODE
=
"
$(
mktmpdir node
)
"
VENDORED_NPM
=
"
$(
mktmpdir npm
)
"
VENDORED_SCONS
=
"
$(
mktmpdir scons
)
"
status
"Downloading node v
$NODE_VERSION
"
echo
"
$NODE_URL
"
| indent
tar_download
$NODE_URL
echo
"-----> Fetching node binary"
status
"Moving node and npm to build directory"
mv
$BUILD_DIR
/node-v
$NODE_VERSION
-linux-x64
$BUILD_DIR
/node
echo
"-----> Vendoring node binary into slug"
PATH
=
"
$BUILD_DIR
/bin:
$PATH
"
mkdir
-p
"
$BUILD_DIR
/bin"
cp
"
$VENDORED_NODE
/bin/node"
"
$BUILD_DIR
/bin/node"
status
"Making node and npm executable"
chmod
+x
$BUILD_DIR
/node/bin/
*
# setting up paths for building
PATH
=
"
$VENDORED_SCONS
:
$VENDORED_NODE
/bin:
$PATH
"
INCLUDE_PATH
=
"
$VENDORED_NODE
/include"
export
CPATH
=
"
$INCLUDE_PATH
:
$CPATH
"
export
CPPPATH
=
"
$INCLUDE_PATH
:
$CPPPATH
"
status
"Adding node and npm to the
\$
PATH"
PATH
=
$PATH
:
$BUILD_DIR
/node/bin
echo
"node version
$NODE_VERSION
has been installed"
| indent
echo
"----->
Installing dependencies with npm"
run_npm
"install --production"
run_npm
"rebuild"
echo
"Dependencies installed"
| indent
status
"
Installing dependencies with npm"
cd
$BUILD_DIR
npm
install
--production
echo
"Dependencies installed"
| indent
\ No newline at end of file
support/helpers.sh
View file @
741800c6
# fail fast
set
-e
# debug
# set -x
function
tar_download
()
{
url
=
"
$1
"
location
=
"
$2
"
mkdir
-p
$location
curl
$url
-s
-o
- |
tar
xzf -
-C
$location
}
function
error
()
{
echo
" !
$*
"
>
&2
exit
1
}
function
status
()
{
echo
"----->
$*
"
}
function
mktmpdir
()
{
dir
=
$(
mktemp
-t
node-
$1
-XXXX
)
rm
-rf
$dir
...
...
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