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
e2a1b61c
Unverified
Commit
e2a1b61c
authored
Jan 24, 2019
by
Jeremy Morrell
Committed by
GitHub
Jan 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add lib/binaries.sh to shellcheck (#604)
* Make lib/binaries.sh pass shellcheck
parent
f785c74e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
21 deletions
+34
-21
compile
bin/compile
+2
-2
binaries.sh
lib/binaries.sh
+31
-19
makefile
makefile
+1
-0
No files found.
bin/compile
View file @
e2a1b61c
...
...
@@ -137,7 +137,7 @@ install_bins() {
mcount
"version.iojs.
$node_version
"
else
warn_node_engine
"
$node_engine
"
monitor
"install-node-binary"
install_nodejs
"
$node_engine
"
"
$BUILD_DIR
/.heroku/node"
monitor
"install-node-binary"
install_nodejs
"
$node_engine
"
"
$BUILD_DIR
/.heroku/node"
"
$platform
"
monitor
"install-npm-binary"
install_npm
"
$npm_engine
"
"
$BUILD_DIR
/.heroku/node"
$NPM_LOCK
node_version
=
"
$(
node
--version
)
"
mcount
"version.node.
$node_version
"
...
...
@@ -147,7 +147,7 @@ install_bins() {
# has specified a version of yarn under "engines". We'll still
# only install using yarn if there is a yarn.lock file
if
$YARN
||
[
-n
"
$yarn_engine
"
]
;
then
monitor
"install-yarn-binary"
install_yarn
"
$BUILD_DIR
/.heroku/yarn"
"
$yarn_engine
"
monitor
"install-yarn-binary"
install_yarn
"
$BUILD_DIR
/.heroku/yarn"
"
$yarn_engine
"
"
$platform
"
fi
if
$YARN
;
then
...
...
lib/binaries.sh
View file @
e2a1b61c
#!/usr/bin/env bash
install_yarn
()
{
local dir
=
"
$1
"
local
version
=
${
2
:-
1
.x
}
local
number
local
url
local
platform
=
"
$3
"
local
number url code
echo
"Resolving yarn version
$version
..."
if
!
read
number url < <
(
curl
--silent
--get
--retry
5
--retry-max-time
15
--data-urlencode
"range=
$version
"
"https://nodebin.herokai.com/v1/yarn/
$platform
/latest.txt"
)
;
then
fail_bin_install yarn
$version
;
if
!
read
-r
number url < <
(
curl
--silent
--get
--retry
5
--retry-max-time
15
--data-urlencode
"range=
$version
"
"https://nodebin.herokai.com/v1/yarn/
$platform
/latest.txt"
)
;
then
fail_bin_install yarn
"
$version
"
;
fi
echo
"Downloading and installing yarn (
$number
)..."
local
code
=
$(
curl
"
$url
"
-L
--silent
--fail
--retry
5
--retry-max-time
15
-o
/tmp/yarn.tar.gz
--write-out
"%{http_code}"
)
code
=
$(
curl
"
$url
"
-L
--silent
--fail
--retry
5
--retry-max-time
15
-o
/tmp/yarn.tar.gz
--write-out
"%{http_code}"
)
if
[
"
$code
"
!=
"200"
]
;
then
echo
"Unable to download yarn:
$code
"
&&
false
fi
rm
-rf
$dir
rm
-rf
"
$dir
"
mkdir
-p
"
$dir
"
# https://github.com/yarnpkg/yarn/issues/770
if
tar
--version
|
grep
-q
'gnu'
;
then
...
...
@@ -22,54 +24,64 @@ install_yarn() {
else
tar
xzf /tmp/yarn.tar.gz
-C
"
$dir
"
--strip
1
fi
chmod
+x
$dir
/bin/
*
chmod
+x
"
$dir
"
/bin/
*
echo
"Installed yarn
$(
yarn
--version
)
"
}
install_nodejs
()
{
local
version
=
${
1
:-
10
.x
}
local dir
=
"
${
2
:?
}
"
local
platform
=
"
$3
"
local
code os cpu
os
=
$(
get_os
)
cpu
=
$(
get_cpu
)
echo
"Resolving node version
$version
..."
if
!
read
number url < <
(
curl
--silent
--get
--retry
5
--retry-max-time
15
--data-urlencode
"range=
$version
"
"https://nodebin.herokai.com/v1/node/
$platform
/latest.txt"
)
;
then
fail_bin_install node
$version
;
if
!
read
-r
number url < <
(
curl
--silent
--get
--retry
5
--retry-max-time
15
--data-urlencode
"range=
$version
"
"https://nodebin.herokai.com/v1/node/
$platform
/latest.txt"
)
;
then
fail_bin_install node
"
$version
"
;
fi
echo
"Downloading and installing node
$number
..."
local
code
=
$(
curl
"
$url
"
-L
--silent
--fail
--retry
5
--retry-max-time
15
-o
/tmp/node.tar.gz
--write-out
"%{http_code}"
)
code
=
$(
curl
"
$url
"
-L
--silent
--fail
--retry
5
--retry-max-time
15
-o
/tmp/node.tar.gz
--write-out
"%{http_code}"
)
if
[
"
$code
"
!=
"200"
]
;
then
echo
"Unable to download node:
$code
"
&&
false
fi
tar
xzf /tmp/node.tar.gz
-C
/tmp
rm
-rf
"
$
dir
"
/
*
mv
/tmp/node-v
$number
-
$os
-
$cpu
/
*
$dir
chmod
+x
$dir
/bin/
*
rm
-rf
"
$
{
dir
:?
}
"
/
*
mv
/tmp/node-v
"
$number
"
-
"
$os
"
-
"
$cpu
"
/
*
"
$dir
"
chmod
+x
"
$dir
"
/bin/
*
}
install_iojs
()
{
local
version
=
"
$1
"
local dir
=
"
$2
"
local
code os cpu
os
=
$(
get_os
)
cpu
=
$(
get_cpu
)
echo
"Resolving iojs version
${
version
:-
(latest stable)
}
..."
if
!
read
number url < <
(
curl
--silent
--get
--retry
5
--retry-max-time
15
--data-urlencode
"range=
$version
"
"https://nodebin.herokai.com/v1/iojs/
$platform
/latest.txt"
)
;
then
fail_bin_install iojs
$version
;
if
!
read
-r
number url < <
(
curl
--silent
--get
--retry
5
--retry-max-time
15
--data-urlencode
"range=
$version
"
"https://nodebin.herokai.com/v1/iojs/
$platform
/latest.txt"
)
;
then
fail_bin_install iojs
"
$version
"
;
fi
echo
"Downloading and installing iojs
$number
..."
local
code
=
$(
curl
"
$url
"
--silent
--fail
--retry
5
--retry-max-time
15
-o
/tmp/iojs.tar.gz
--write-out
"%{http_code}"
)
code
=
$(
curl
"
$url
"
--silent
--fail
--retry
5
--retry-max-time
15
-o
/tmp/iojs.tar.gz
--write-out
"%{http_code}"
)
if
[
"
$code
"
!=
"200"
]
;
then
echo
"Unable to download iojs:
$code
"
&&
false
fi
tar
xzf /tmp/iojs.tar.gz
-C
/tmp
mv
/tmp/iojs-v
$number
-
$os
-
$cpu
/
*
$dir
chmod
+x
$dir
/bin/
*
mv
/tmp/iojs-v
"
$number
"
-
"
$os
"
-
"
$cpu
"
/
*
"
$dir
"
chmod
+x
"
$dir
"
/bin/
*
}
install_npm
()
{
local
npm_version
local
version
=
"
$1
"
local dir
=
"
$2
"
local
npm_lock
=
"
$3
"
local
npm_version
=
"
$(
npm
--version
)
"
npm_version
=
"
$(
npm
--version
)
"
# If the user has not specified a version of npm, but has an npm lockfile
# upgrade them to npm 5.x if a suitable version was not installed with Node
...
...
makefile
View file @
e2a1b61c
...
...
@@ -2,6 +2,7 @@ test: heroku-18 heroku-16 cedar-14
shellcheck
:
@
shellcheck
-x
bin/compile bin/detect bin/release bin/test bin/test-compile
@
shellcheck
-x
lib/binaries.sh
@
echo
TODO shellcheck
-x
lib/
**
/
*
.sh
@
echo
TODO shellcheck
-x
ci-profile/
**
/
*
.sh
@
echo
TODO shellcheck
-x
etc/
**
/
*
.sh
...
...
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