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
26c18bce
Commit
26c18bce
authored
Jan 07, 2014
by
Zeke Sikelianos
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #89 from heroku/env-file
Make config vars available to npm install
parents
c962f1e4
8b280a26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
4 deletions
+35
-4
compile
bin/compile
+13
-3
test
bin/test
+22
-1
No files found.
bin/compile
View file @
26c18bce
...
...
@@ -7,6 +7,8 @@ set -o pipefail # don't ignore exit codes when piping output
# Configure directories
build_dir
=
$1
cache_dir
=
$2
env_file
=
$3
bp_dir
=
$(
cd
$(
dirname
$0
)
;
cd
..
;
pwd
)
# Load some convenience functions like status(), echo(), and indent()
...
...
@@ -67,9 +69,17 @@ elif test -d $cache_dir/node_modules; then
npm prune 2>&1 | indent
fi
# Make npm output to STDOUT instead of its default STDERR
status
"Installing dependencies"
npm
install
--userconfig
$build_dir
/.npmrc
--production
2>&1 | indent
# Scope config var availability only to `npm install`
(
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"
rm
-rf
$cache_dir
/node_modules
...
...
bin/test
View file @
26c18bce
...
...
@@ -104,6 +104,27 @@ testProcfileAbsentNpmStartAbsent() {
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"
assertCapturedSuccess
}
testEnvfileImported
()
{
env_file
=
$(
mktemp
)
echo
"FOO=1"
>
$env_file
compile
"stable-node"
"
$(
mktmpdir
)
"
$env_file
assertCaptured
"Importing application config vars"
assertCapturedSuccess
}
# Utils
pushd
$(
dirname
0
)
>
/dev/null
...
...
@@ -128,7 +149,7 @@ compile_dir=""
compile
()
{
compile_dir
=
$(
mktmpdir
)
cp
-r
${
bp_dir
}
/test/
$1
/.
${
compile_dir
}
capture
${
bp_dir
}
/bin/compile
${
compile_dir
}
${
2
:-$(
mktmpdir
)}
capture
${
bp_dir
}
/bin/compile
${
compile_dir
}
${
2
:-$(
mktmpdir
)}
$3
}
assertFile
()
{
...
...
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