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
c56b58c8
Commit
c56b58c8
authored
Dec 13, 2013
by
zeke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
experiment
parent
1e9b4890
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
16 deletions
+38
-16
compile
bin/compile
+12
-16
test
bin/test
+26
-0
No files found.
bin/compile
View file @
c56b58c8
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
set
-e
# fail fast
set
-e
# fail fast
set
-o
pipefail
# don't ignore exit codes when piping output
set
-o
pipefail
# don't ignore exit codes when piping output
set
-x
# enable debugging
# set -x
# enable debugging
# Configure directories
# Configure directories
build_dir
=
$1
build_dir
=
$1
...
@@ -17,18 +17,6 @@ source $bp_dir/bin/common.sh
...
@@ -17,18 +17,6 @@ source $bp_dir/bin/common.sh
# Output npm debug info on error
# Output npm debug info on error
trap
cat_npm_debug_log ERR
trap
cat_npm_debug_log ERR
if
[
"
$env_file
"
]
;
then
status
"before:"
env
status
"Here's your env_file:"
status
"
$env_file
"
export
$(
egrep
-v
"^(PATH)"
$env_file
)
status
"after:"
env
fi
# Look in package.json's engines.node field for a semver range
# Look in package.json's engines.node field for a semver range
semver_range
=
$(
cat
$build_dir
/package.json |
$bp_dir
/vendor/jq
-r
.engines.node
)
semver_range
=
$(
cat
$build_dir
/package.json |
$bp_dir
/vendor/jq
-r
.engines.node
)
...
@@ -81,9 +69,17 @@ elif test -d $cache_dir/node_modules; then
...
@@ -81,9 +69,17 @@ elif test -d $cache_dir/node_modules; then
npm prune 2>&1 | indent
npm prune 2>&1 | indent
fi
fi
# Make npm output to STDOUT instead of its default STDERR
# Scope config var availability only to `npm install`
status
"Installing dependencies"
(
npm
install
--userconfig
$build_dir
/.npmrc
--production
2>&1 | indent
if
[
"
$env_file
"
]
;
then
status
"Importing application config vars"
export
$(
egrep
-v
"^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)"
"
$env_file
"
)
fi
status
"Installing dependencies"
# Make npm output to STDOUT instead of its default STDERR
npm
install
--userconfig
$build_dir
/.npmrc
--production
2>&1 | indent
)
status
"Caching node_modules directory for future builds"
status
"Caching node_modules directory for future builds"
rm
-rf
$cache_dir
rm
-rf
$cache_dir
...
...
bin/test
View file @
c56b58c8
...
@@ -104,6 +104,23 @@ testProcfileAbsentNpmStartAbsent() {
...
@@ -104,6 +104,23 @@ testProcfileAbsentNpmStartAbsent() {
assertCapturedSuccess
assertCapturedSuccess
}
}
testProcfileAbsentNpmStartPresent
()
{
compile
"procfile-absent-npm-start-present"
assertCaptured
"No Procfile found; Adding npm start to new Procfile"
assertFile
"web: npm start"
"Procfile"
assertCapturedSuccess
}
testEnvfileNotImported
()
{
compile
"stable-node"
assertNotCaptured
"Importing application config vars"
}
testEnvfileImported
()
{
compileWithEnv
"stable-node"
assertCaptured
"Importing application config vars"
}
# Pending Tests
# Pending Tests
# testNodeBinariesAddedToPath() {
# testNodeBinariesAddedToPath() {
...
@@ -132,6 +149,8 @@ testProcfileAbsentNpmStartAbsent() {
...
@@ -132,6 +149,8 @@ testProcfileAbsentNpmStartAbsent() {
# assertCapturedError 1 "not found among available versions"
# assertCapturedError 1 "not found among available versions"
# }
# }
# Utils
# Utils
pushd
$(
dirname
0
)
>
/dev/null
pushd
$(
dirname
0
)
>
/dev/null
...
@@ -159,6 +178,13 @@ compile() {
...
@@ -159,6 +178,13 @@ compile() {
capture
${
bp_dir
}
/bin/compile
${
compile_dir
}
${
2
:-$(
mktmpdir
)}
capture
${
bp_dir
}
/bin/compile
${
compile_dir
}
${
2
:-$(
mktmpdir
)}
}
}
compileWithEnv
()
{
compile_dir
=
$(
mktmpdir
)
env_file
=
"FOO=1;BAR=2;"
cp
-r
${
bp_dir
}
/test/
$1
/.
${
compile_dir
}
capture
${
bp_dir
}
/bin/compile
${
compile_dir
}
${
2
:-$(
mktmpdir
)
$env_file
}
}
assertFile
()
{
assertFile
()
{
assertEquals
"
$1
"
"
$(
cat
${
compile_dir
}
/
$2
)
"
assertEquals
"
$1
"
"
$(
cat
${
compile_dir
}
/
$2
)
"
}
}
...
...
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