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
58a473e0
Commit
58a473e0
authored
Sep 12, 2013
by
zeke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
line up the strings and get the tests passing again
parent
45f6360d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
22 deletions
+23
-22
common.sh
bin/common.sh
+2
-2
compile
bin/compile
+5
-4
test
bin/test
+16
-16
No files found.
bin/common.sh
View file @
58a473e0
...
@@ -52,8 +52,8 @@ status() {
...
@@ -52,8 +52,8 @@ status() {
indent
()
{
indent
()
{
c
=
's/^/ /'
c
=
's/^/ /'
case
$(
uname
)
in
case
$(
uname
)
in
Darwin
)
sed
-l
"
$c
"
;;
Darwin
)
sed
-l
"
$c
"
;;
# mac/bsd sed: -l buffers on line boundaries
*
)
sed
-u
"
$c
"
;;
*
)
sed
-u
"
$c
"
;;
# unix/gnu sed: -u unbuffered (arbitrary) chunks of data
esac
esac
}
}
...
...
bin/compile
View file @
58a473e0
...
@@ -8,7 +8,7 @@ stable_version="0.10.18"
...
@@ -8,7 +8,7 @@ stable_version="0.10.18"
source
$bp_dir
/bin/common.sh
source
$bp_dir
/bin/common.sh
# Output debug info on exit
# Output debug info on exit
trap
cat_npm_debug_log EXIT
#
trap cat_npm_debug_log EXIT
# Bootstrap the build process with latest stable version of node
# Bootstrap the build process with latest stable version of node
# We'll use it to parse package.json and do semver detection
# We'll use it to parse package.json and do semver detection
...
@@ -16,6 +16,7 @@ download_and_install_node $stable_version
...
@@ -16,6 +16,7 @@ download_and_install_node $stable_version
# Is a node version specified in package.json?
# Is a node version specified in package.json?
determine_requested_version
()
{
determine_requested_version
()
{
# https://github.com/trentm/json
v
=
$(
cat
$build_dir
/package.json | node
$bp_dir
/vendor/json engines.node 2>/dev/null
)
v
=
$(
cat
$build_dir
/package.json | node
$bp_dir
/vendor/json engines.node 2>/dev/null
)
if
[
$?
==
0
]
;
then
echo
$v
;
fi
if
[
$?
==
0
]
;
then
echo
$v
;
fi
}
}
...
@@ -28,14 +29,14 @@ if ! test $requested_version; then
...
@@ -28,14 +29,14 @@ if ! test $requested_version; then
echo
"WARNING: No node version specified in package.json, see:"
| indent
echo
"WARNING: No node version specified in package.json, see:"
| indent
echo
"https://devcenter.heroku.com/articles/nodejs-support#versions"
| indent
echo
"https://devcenter.heroku.com/articles/nodejs-support#versions"
| indent
echo
echo
status
"Defaulting to
node v
$stable_version
(latest stable)
"
status
"Defaulting to
latest stable node, v
$stable_version
"
else
else
# Does the already-downloaded stable version of node satisfy the requested version?
# Does the already-downloaded stable version of node satisfy the requested version?
default_satisfies
=
$(
node
$bp_dir
/vendor/semver/bin/semver
-v
"
${
stable_version
}
"
-r
"
${
requested_version
}
"
||
echo
""
)
default_satisfies
=
$(
node
$bp_dir
/vendor/semver/bin/semver
-v
"
${
stable_version
}
"
-r
"
${
requested_version
}
"
||
echo
""
)
if
test
$default_satisfies
;
then
if
test
$default_satisfies
;
then
status
"
Using node v
$stable_version
"
status
"
Latest stable node v
$stable_version
satisfies engines.node:
$requested
"
node_version
=
$stable_version
node_version
=
$stable_version
else
else
# Find all available versions from nodejs.org/dist
# Find all available versions from nodejs.org/dist
...
@@ -53,7 +54,7 @@ else
...
@@ -53,7 +54,7 @@ else
if
test
$node_version
;
then
if
test
$node_version
;
then
download_and_install_node
$node_version
download_and_install_node
$node_version
else
else
error
"
Requested node version
${
requested_version
}
not found among available versions on nodejs.org/dist"
error
"
node
${
requested_version
}
not found among available versions on nodejs.org/dist"
fi
fi
fi
fi
fi
fi
...
...
bin/test
View file @
58a473e0
...
@@ -8,41 +8,41 @@
...
@@ -8,41 +8,41 @@
# run the tests
# run the tests
#
#
#
testDetectWithPackageJson() {
testDetectWithPackageJson
()
{
#
detect "package-json-stable-version"
detect
"package-json-stable-version"
#
assertCaptured "Node.js"
assertCaptured
"Node.js"
#
assertCapturedSuccess
assertCapturedSuccess
#
}
}
#
testDetectWithoutPackageJson() {
testDetectWithoutPackageJson
()
{
#
detect "no-package-json"
detect
"no-package-json"
#
assertCapturedError 1 ""
assertCapturedError 1
""
#
}
}
testPackageJsonWithoutVersion
()
{
testPackageJsonWithoutVersion
()
{
compile
"package-json-noversion"
compile
"package-json-noversion"
assertCaptured
"WARNING: No node version specified"
assertCaptured
"WARNING: No node version specified"
assertCaptured
"
Using
latest stable node"
assertCaptured
"
Defaulting to
latest stable node"
assertCapturedSuccess
assertCapturedSuccess
}
}
testPackageJsonWithStableVersion
()
{
testPackageJsonWithStableVersion
()
{
compile
"package-json-stable-version"
compile
"package-json-stable-version"
assertNotCaptured
"WARNING: No node version specified"
assertNotCaptured
"WARNING: No node version specified"
assertCaptured
"
Using latest stable
node"
assertCaptured
"
satisfies engines.
node"
assertCapturedSuccess
assertCapturedSuccess
}
}
testPackageJsonWithUnstableVersion
()
{
testPackageJsonWithUnstableVersion
()
{
compile
"package-json-unstable-version"
compile
"package-json-unstable-version"
assertCaptured
"
Using node version
0.11"
assertCaptured
"
Downloading and installing node v
0.11"
assertCapturedSuccess
assertCapturedSuccess
}
}
#
testPackageJsonWithInvalidVersion() {
testPackageJsonWithInvalidVersion
()
{
#
compile "package-json-invalidversion"
compile
"package-json-invalidversion"
# assertCapturedError 1 "Requested node version 5.0 not found
"
assertCapturedError 1
"not found among available versions
"
#
}
}
testProfileCreated
()
{
testProfileCreated
()
{
compile
"package-json-stable-version"
compile
"package-json-stable-version"
...
...
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