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
13d9f415
Commit
13d9f415
authored
Dec 31, 2014
by
Hunter Loftis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test for pre and postinstall scripts with checked in modules, cleanup
parent
f70f0256
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
28 deletions
+21
-28
common.sh
bin/common.sh
+9
-14
compile
bin/compile
+5
-14
test
bin/test
+3
-0
package.json
test/modules-checked-in/package.json
+4
-0
No files found.
bin/common.sh
View file @
13d9f415
...
...
@@ -59,22 +59,17 @@ cat_npm_debug_log() {
test
-f
$build_dir
/npm-debug.log
&&
cat
$build_dir
/npm-debug.log
}
tail_error_log
()
{
echo
""
echo
" ! Build failure:"
echo
""
tail
-n
500
$logfile
| indent
}
export_env_dir
()
{
env_dir
=
$1
whitelist_regex
=
${
2
:-
''
}
blacklist_regex
=
${
3
:-
'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)$'
}
if
[
-d
"
$env_dir
"
]
;
then
for
e
in
$(
ls
$env_dir
)
;
do
echo
"
$e
"
|
grep
-E
"
$whitelist_regex
"
|
grep
-qvE
"
$blacklist_regex
"
&&
export
"
$e
=
$(
cat
$env_dir
/
$e
)
"
:
done
whitelist_regex
=
${
2
:-
''
}
blacklist_regex
=
${
3
:-
'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)$'
}
if
[
-d
"
$env_dir
"
]
;
then
for
e
in
$(
ls
$env_dir
)
;
do
echo
"
$e
"
|
grep
-E
"
$whitelist_regex
"
|
grep
-qvE
"
$blacklist_regex
"
&&
export
"
$e
=
$(
cat
$env_dir
/
$e
)
"
:
done
fi
fi
}
bin/compile
View file @
13d9f415
...
...
@@ -6,38 +6,27 @@ set -e # fail fast
set
-o
pipefail
# don't ignore exit codes when piping output
# set -x # enable debugging
bp_version
=
"63-rc"
# Configure directories
build_dir
=
$1
cache_dir
=
$2
env_dir
=
$3
bp_dir
=
$(
cd
$(
dirname
$0
)
;
cd
..
;
pwd
)
heroku_dir
=
$build_dir
/.heroku
logfile
=
/tmp/node-log.txt
mkdir
-p
$heroku_dir
/node
# Load some convenience functions like status(), echo(), and indent()
source
$bp_dir
/bin/common.sh
# Output version
head
"Node.js Buildpack v
$bp_version
"
# Avoid GIT_DIR leak from previous build steps
unset
GIT_DIR
# Create directories & log file
mkdir
-p
$heroku_dir
/node
echo
""
>
$logfile
# Provide hook to deal with errors
trap
build_failed ERR
# Load config vars into environment; start with defaults
export
NPM_CONFIG_PRODUCTION
=
true
export
NODE_MODULES_CACHE
=
true
if
[
-d
"
$env_dir
"
]
;
then
export_env_dir
$env_dir
fi
export_env_dir
$env_dir
####### Determine current state
...
...
@@ -146,7 +135,9 @@ if [ "$modules_source" == "" ]; then
elif
[
$modules_source
==
"prebuilt"
]
;
then
info
"Rebuilding any native modules for this architecture"
npm run preinstall
npm rebuild 2>&1
npm run postinstall
elif
$use_cache
;
then
info
"Restoring node modules from cache"
...
...
bin/test
View file @
13d9f415
...
...
@@ -105,7 +105,9 @@ testBuildWithCache() {
testModulesCheckedIn
()
{
compile
"modules-checked-in"
assertCaptured
"node_modules source: prebuilt"
assertCaptured
"(preinstall script)"
assertCaptured
"Rebuilding any native modules for this architecture"
assertCaptured
"(postinstall script)"
assertNotCaptured
"Restoring node modules"
assertNotCaptured
"Pruning unused dependencies"
assertNotCaptured
"Installing any new modules"
...
...
@@ -154,6 +156,7 @@ testProcfileAbsentServerPresent() {
testServerPresentOnly
()
{
compile
"server-present-only"
assertCaptured
"PRO TIP: Use 'npm init'"
assertCaptured
"Skipping dependencies"
assertCaptured
"'web: node server.js' to new Procfile"
assertFile
"web: node server.js"
"Procfile"
assertCapturedSuccess
...
...
test/modules-checked-in/package.json
View file @
13d9f415
...
...
@@ -6,6 +6,10 @@
"type"
:
"git"
,
"url"
:
"http://github.com/example/example.git"
},
"scripts"
:
{
"preinstall"
:
"echo '(preinstall script)'"
,
"postinstall"
:
"echo '(postinstall script)'"
},
"dependencies"
:
{
"hashish"
:
"*"
},
...
...
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