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
0048d0ca
Commit
0048d0ca
authored
Jan 13, 2015
by
Hunter Loftis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preliminary test and implementation for iojs support
parent
bb9f8611
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
3 deletions
+63
-3
compile
bin/compile
+7
-1
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 @
0048d0ca
...
@@ -33,6 +33,7 @@ export NODE_MODULES_CACHE=${NODE_MODULES_CACHE:-true}
...
@@ -33,6 +33,7 @@ export NODE_MODULES_CACHE=${NODE_MODULES_CACHE:-true}
####### Determine current state
####### Determine current state
iojs_engine
=
$(
read_json
"
$build_dir
/package.json"
".engines.iojs"
)
node_engine
=
$(
read_json
"
$build_dir
/package.json"
".engines.node"
)
node_engine
=
$(
read_json
"
$build_dir
/package.json"
".engines.node"
)
node_previous
=
$(
file_contents
"
$cache_dir
/node/node-version"
)
node_previous
=
$(
file_contents
"
$cache_dir
/node/node-version"
)
npm_engine
=
$(
read_json
"
$build_dir
/package.json"
".engines.npm"
)
npm_engine
=
$(
read_json
"
$build_dir
/package.json"
".engines.npm"
)
...
@@ -49,7 +50,12 @@ warn_node_modules "$modules_source"
...
@@ -49,7 +50,12 @@ warn_node_modules "$modules_source"
####### Vendor in binaries
####### Vendor in binaries
head
"Installing binaries"
head
"Installing binaries"
install_node
if
[
"
$iojs_engine
"
==
""
]
;
then
install_node
else
install_iojs
fi
node_engine
=
`
node
--version
`
install_npm
install_npm
####### Build the project's dependencies
####### Build the project's dependencies
...
...
bin/test
View file @
0048d0ca
...
@@ -18,6 +18,14 @@ testDetectWithoutPackageJson() {
...
@@ -18,6 +18,14 @@ testDetectWithoutPackageJson() {
assertCapturedError 1
""
assertCapturedError 1
""
}
}
testIoJs
()
{
compile
"iojs"
assertCaptured
"Node engine: 1.0."
assertCaptured
"(iojs)"
assertCaptured
"detected node version: v1.0."
assertCapturedSuccess
}
testNoVersion
()
{
testNoVersion
()
{
compile
"no-version"
compile
"no-version"
assertCaptured
"Node engine: unspecified"
assertCaptured
"Node engine: unspecified"
...
...
lib/build.sh
View file @
0048d0ca
...
@@ -55,12 +55,16 @@ get_modules_cached() {
...
@@ -55,12 +55,16 @@ get_modules_cached() {
show_current_state
()
{
show_current_state
()
{
echo
""
echo
""
info
"Node engine:
${
node_engine
:-
unspecified
}
"
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
"Npm engine:
${
npm_engine
:-
unspecified
}
"
info
"Start mechanism:
${
start_method
:-
none
}
"
info
"Start mechanism:
${
start_method
:-
none
}
"
info
"node_modules source:
${
modules_source
:-
none
}
"
info
"node_modules source:
${
modules_source
:-
none
}
"
info
"node_modules cached:
$modules_cached
"
info
"node_modules cached:
$modules_cached
"
echo
""
echo
""
printenv
|
grep
^NPM_CONFIG_ | indent
printenv
|
grep
^NPM_CONFIG_ | indent
...
@@ -85,6 +89,24 @@ install_node() {
...
@@ -85,6 +89,24 @@ install_node() {
PATH
=
$heroku_dir
/node/bin:
$PATH
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: remove nightly, point at /dist once that's available
info
"Downloading and installing iojs
$iojs_engine
..."
download_url
=
"https://iojs.org/download/nightly/v
$iojs_engine
-nightly201501135ea716d895/iojs-v
$iojs_engine
-nightly201501135ea716d895-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
-nightly201501135ea716d895-linux-x64
/
*
$heroku_dir
/node
chmod
+x
$heroku_dir
/node/bin/
*
PATH
=
$heroku_dir
/node/bin:
$PATH
}
install_npm
()
{
install_npm
()
{
# Optionally bootstrap a different npm version
# Optionally bootstrap a different npm version
if
[
"
$npm_engine
"
!=
""
]
;
then
if
[
"
$npm_engine
"
!=
""
]
;
then
...
...
lib/common.sh
View file @
0048d0ca
...
@@ -21,6 +21,12 @@ warning() {
...
@@ -21,6 +21,12 @@ warning() {
echo
""
>>
$warnings
echo
""
>>
$warnings
}
}
achievement
()
{
local
msg
=
$1
echo
" ACHIEVEMENT UNLOCKED:
$msg
:)"
echo
""
}
file_contents
()
{
file_contents
()
{
if
test
-f
$1
;
then
if
test
-f
$1
;
then
echo
"
$(
cat
$1
)
"
echo
"
$(
cat
$1
)
"
...
...
test/iojs/package.json
0 → 100644
View file @
0048d0ca
{
"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