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
3ec73e1b
Commit
3ec73e1b
authored
Jan 14, 2015
by
Hunter Loftis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid updating node_engine state
parent
a77cd257
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
26 deletions
+34
-26
compile
bin/compile
+2
-3
build.sh
lib/build.sh
+32
-23
No files found.
bin/compile
View file @
3ec73e1b
...
@@ -55,11 +55,10 @@ warn_node_modules "$modules_source"
...
@@ -55,11 +55,10 @@ warn_node_modules "$modules_source"
head
"Installing binaries"
head
"Installing binaries"
if
[
"
$iojs_engine
"
==
""
]
;
then
if
[
"
$iojs_engine
"
==
""
]
;
then
install_node
install_node
"
$node_engine
"
else
else
install_iojs
install_iojs
"
$iojs_engine
"
fi
fi
node_engine
=
`
node
--version
`
install_npm
install_npm
####### Build the project's dependencies
####### Build the project's dependencies
...
...
lib/build.sh
View file @
3ec73e1b
...
@@ -72,6 +72,8 @@ show_current_state() {
...
@@ -72,6 +72,8 @@ show_current_state() {
}
}
install_node
()
{
install_node
()
{
local
node_engine
=
$1
# Resolve non-specific node versions using semver.herokuapp.com
# Resolve non-specific node versions using semver.herokuapp.com
if
!
[[
"
$node_engine
"
=
~ ^[0-9]+
\.
[
0-9]+
\.
[
0-9]+
$
]]
;
then
if
!
[[
"
$node_engine
"
=
~ ^[0-9]+
\.
[
0-9]+
\.
[
0-9]+
$
]]
;
then
info
"Resolving node version
${
node_engine
:-
(latest stable)
}
via semver.io..."
info
"Resolving node version
${
node_engine
:-
(latest stable)
}
via semver.io..."
...
@@ -90,8 +92,10 @@ install_node() {
...
@@ -90,8 +92,10 @@ install_node() {
}
}
install_iojs
()
{
install_iojs
()
{
local
iojs_engine
=
$1
# Resolve non-specific iojs versions using semver.herokuapp.com
# Resolve non-specific iojs versions using semver.herokuapp.com
if
!
[[
"
$
node
_engine
"
=
~ ^[0-9]+
\.
[
0-9]+
\.
[
0-9]+
$
]]
;
then
if
!
[[
"
$
iojs
_engine
"
=
~ ^[0-9]+
\.
[
0-9]+
\.
[
0-9]+
$
]]
;
then
info
"Resolving iojs version
${
iojs_engine
:-
(latest stable)
}
via semver.io..."
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
)
iojs_engine
=
$(
curl
--silent
--get
--data-urlencode
"range=
${
iojs_engine
}
"
https://semver.herokuapp.com/iojs/resolve
)
fi
fi
...
@@ -126,21 +130,6 @@ install_npm() {
...
@@ -126,21 +130,6 @@ install_npm() {
fi
fi
}
}
get_cache_status
()
{
# Did we bust the cache?
if
!
$modules_cached
;
then
echo
"No cache available"
elif
!
$NODE_MODULES_CACHE
;
then
echo
"Cache disabled with NODE_MODULES_CACHE"
elif
[
"
$node_previous
"
!=
""
]
&&
[
"
$node_engine
"
!=
"
$node_previous
"
]
;
then
echo
"Node version changed (
$node_previous
=>
$node_engine
); invalidating cache"
elif
[
"
$npm_previous
"
!=
""
]
&&
[
"
$npm_engine
"
!=
"
$npm_previous
"
]
;
then
echo
"Npm version changed (
$npm_previous
=>
$npm_engine
); invalidating cache"
else
echo
"valid"
fi
}
ensure_procfile
()
{
ensure_procfile
()
{
local
start_method
=
$1
local
start_method
=
$1
local
build_dir
=
$2
local
build_dir
=
$2
...
@@ -176,20 +165,40 @@ clean_npm() {
...
@@ -176,20 +165,40 @@ clean_npm() {
rm
-rf
"
$build_dir
/.npm"
rm
-rf
"
$build_dir
/.npm"
}
}
clean_cache
()
{
# Caching
info
"Cleaning previous cache"
rm
-rf
"
$cache_dir
/node_modules"
# (for apps still on the older caching strategy)
rm
-rf
"
$cache_dir
/node"
}
create_cache
()
{
create_cache
()
{
info
"Caching results for future builds"
info
"Caching results for future builds"
mkdir
-p
$cache_dir
/node
mkdir
-p
$cache_dir
/node
echo
$node_engine
>
$cache_dir
/node/node-version
echo
`
node
--version
`
>
$cache_dir
/node/node-version
echo
$npm_engine
>
$cache_dir
/node/npm-version
echo
`
npm
--version
`
>
$cache_dir
/node/npm-version
if
test
-d
$build_dir
/node_modules
;
then
if
test
-d
$build_dir
/node_modules
;
then
cp
-r
$build_dir
/node_modules
$cache_dir
/node
cp
-r
$build_dir
/node_modules
$cache_dir
/node
fi
fi
}
}
clean_cache
()
{
info
"Cleaning previous cache"
rm
-rf
"
$cache_dir
/node_modules"
# (for apps still on the older caching strategy)
rm
-rf
"
$cache_dir
/node"
}
get_cache_status
()
{
local
node_version
=
`
node
--version
`
local
npm_version
=
`
npm
--version
`
# Did we bust the cache?
if
!
$modules_cached
;
then
echo
"No cache available"
elif
!
$NODE_MODULES_CACHE
;
then
echo
"Cache disabled with NODE_MODULES_CACHE"
elif
[
"
$node_previous
"
!=
""
]
&&
[
"
$node_version
"
!=
"
$node_previous
"
]
;
then
echo
"Node version changed (
$node_previous
=>
$node_version
); invalidating cache"
elif
[
"
$npm_previous
"
!=
""
]
&&
[
"
$npm_version
"
!=
"
$npm_previous
"
]
;
then
echo
"Npm version changed (
$npm_previous
=>
$npm_version
); invalidating cache"
else
echo
"valid"
fi
}
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