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
a77cd257
Commit
a77cd257
authored
Jan 14, 2015
by
Hunter Loftis
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #181 from heroku/iojs-engine
Iojs engine
parents
bb9f8611
1b240387
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
4 deletions
+68
-4
compile
bin/compile
+12
-2
test
bin/test
+8
-0
build.sh
lib/build.sh
+24
-2
common.sh
lib/common.sh
+6
-0
package.json
test/iojs/package.json
+18
-0
No files found.
bin/compile
View file @
a77cd257
...
...
@@ -33,6 +33,7 @@ export NODE_MODULES_CACHE=${NODE_MODULES_CACHE:-true}
####### Determine current state
iojs_engine
=
$(
read_json
"
$build_dir
/package.json"
".engines.iojs"
)
node_engine
=
$(
read_json
"
$build_dir
/package.json"
".engines.node"
)
node_previous
=
$(
file_contents
"
$cache_dir
/node/node-version"
)
npm_engine
=
$(
read_json
"
$build_dir
/package.json"
".engines.npm"
)
...
...
@@ -43,13 +44,22 @@ modules_cached=$(get_modules_cached "$cache_dir")
show_current_state
warn_node_engine
"
$node_engine
"
if
[
"
$iojs_engine
"
==
""
]
;
then
warn_node_engine
"
$node_engine
"
else
warn_node_engine
"
$iojs_engine
"
fi
warn_node_modules
"
$modules_source
"
####### Vendor in binaries
head
"Installing binaries"
install_node
if
[
"
$iojs_engine
"
==
""
]
;
then
install_node
else
install_iojs
fi
node_engine
=
`
node
--version
`
install_npm
####### Build the project's dependencies
...
...
bin/test
View file @
a77cd257
...
...
@@ -18,6 +18,14 @@ testDetectWithoutPackageJson() {
assertCapturedError 1
""
}
testIoJs
()
{
compile
"iojs"
assertCaptured
"Node engine: 1.0."
assertCaptured
"(iojs)"
assertCaptured
"detected node version: v1.0."
assertCapturedSuccess
}
testNoVersion
()
{
compile
"no-version"
assertCaptured
"Node engine: unspecified"
...
...
lib/build.sh
View file @
a77cd257
...
...
@@ -55,12 +55,16 @@ get_modules_cached() {
show_current_state
()
{
echo
""
if
[
"
$iojs_engine
"
==
""
]
;
then
info
"Node engine:
${
node_engine
:-
unspecified
}
"
else
achievement
"iojs"
info
"Node engine:
$iojs_engine
(iojs)"
fi
info
"Npm engine:
${
npm_engine
:-
unspecified
}
"
info
"Start mechanism:
${
start_method
:-
none
}
"
info
"node_modules source:
${
modules_source
:-
none
}
"
info
"node_modules cached:
$modules_cached
"
echo
""
printenv
|
grep
^NPM_CONFIG_ | indent
...
...
@@ -85,6 +89,24 @@ install_node() {
PATH
=
$heroku_dir
/node/bin:
$PATH
}
install_iojs
()
{
# Resolve non-specific iojs versions using semver.herokuapp.com
if
!
[[
"
$node_engine
"
=
~ ^[0-9]+
\.
[
0-9]+
\.
[
0-9]+
$
]]
;
then
info
"Resolving iojs version
${
iojs_engine
:-
(latest stable)
}
via semver.io..."
iojs_engine
=
$(
curl
--silent
--get
--data-urlencode
"range=
${
iojs_engine
}
"
https://semver.herokuapp.com/iojs/resolve
)
fi
# TODO: point at /dist once that's available
info
"Downloading and installing iojs
$iojs_engine
..."
download_url
=
"https://iojs.org/dist/v
$iojs_engine
/iojs-v
$iojs_engine
-linux-x64.tar.gz"
curl
$download_url
-s
-o
- |
tar
xzf -
-C
/tmp
# Move iojs/node (and npm) binaries into .heroku/node and make them executable
mv
/tmp/iojs-v
$iojs_engine
-linux-x64
/
*
$heroku_dir
/node
chmod
+x
$heroku_dir
/node/bin/
*
PATH
=
$heroku_dir
/node/bin:
$PATH
}
install_npm
()
{
# Optionally bootstrap a different npm version
if
[
"
$npm_engine
"
!=
""
]
;
then
...
...
lib/common.sh
View file @
a77cd257
...
...
@@ -21,6 +21,12 @@ warning() {
echo
""
>>
$warnings
}
achievement
()
{
local
msg
=
$1
echo
" ACHIEVEMENT UNLOCKED:
$msg
:)"
echo
""
}
file_contents
()
{
if
test
-f
$1
;
then
echo
"
$(
cat
$1
)
"
...
...
test/iojs/package.json
0 → 100644
View file @
a77cd257
{
"name"
:
"node-buildpack-test-app"
,
"version"
:
"0.0.1"
,
"description"
:
"node buildpack integration test app"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"http://github.com/example/example.git"
},
"dependencies"
:
{
"hashish"
:
"*"
},
"engines"
:
{
"iojs"
:
"1.0.x"
},
"scripts"
:
{
"postinstall"
:
"echo
\"
detected node version:
\"
`node --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