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
eafebb02
Commit
eafebb02
authored
Aug 10, 2013
by
zeke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
look for version requirement in package.json
parent
edfa6f7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
196 deletions
+14
-196
compile
bin/compile
+14
-5
JSON.sh
vendor/JSON.sh
+0
-191
json
vendor/json
+0
-0
No files found.
bin/compile
View file @
eafebb02
...
@@ -3,24 +3,33 @@
...
@@ -3,24 +3,33 @@
BUILD_DIR
=
$1
BUILD_DIR
=
$1
CACHE_DIR
=
$2
CACHE_DIR
=
$2
BIN_DIR
=
$(
cd
$(
dirname
$0
)
;
pwd
)
# absolute path
BIN_DIR
=
$(
cd
$(
dirname
$0
)
;
pwd
)
# absolute path
NODE
_VERSION
=
"0.10.15"
DEFAULT
_VERSION
=
"0.10.15"
NODE_URL
=
"http://s3pository.heroku.com/node/v
$
NODE_VERSION
/node-v
$NODE
_VERSION
-linux-x64.tar.gz"
NODE_URL
=
"http://s3pository.heroku.com/node/v
$
DEFAULT_VERSION
/node-v
$DEFAULT
_VERSION
-linux-x64.tar.gz"
source
$BIN_DIR
/common.sh
source
$BIN_DIR
/common.sh
# Output debug info on exit
# Output debug info on exit
trap
cat_npm_debug_log EXIT
trap
cat_npm_debug_log EXIT
status
"Downloading node v
$
NODE
_VERSION
"
status
"Downloading node v
$
DEFAULT
_VERSION
"
tar_download
$NODE_URL
$BUILD_DIR
tar_download
$NODE_URL
$BUILD_DIR
status
"Adding node and npm to
\$
PATH"
status
"Adding node and npm to
\$
PATH"
mv
$BUILD_DIR
/node-v
$
NODE
_VERSION
-linux-x64
$BUILD_DIR
/node
mv
$BUILD_DIR
/node-v
$
DEFAULT
_VERSION
-linux-x64
$BUILD_DIR
/node
chmod
+x
$BUILD_DIR
/node/bin/
*
chmod
+x
$BUILD_DIR
/node/bin/
*
PATH
=
$PATH
:
$BUILD_DIR
/node/bin
PATH
=
$PATH
:
$BUILD_DIR
/node/bin
status
"Installing dependencies with npm"
cd
$BUILD_DIR
cd
$BUILD_DIR
# Is a node version present in package.json?
DESIRED_VERSION
=
$(
cat
$BUILD_DIR
/package.json | node
$HOME
/vendor/json engines.node 2>/dev/null
)
echo
"DESIRED_VERSION:
$DESIRED_VERSION
"
if
[
"
$DESIRED_VERSION
"
!=
""
]
SATISFIED_VERSION
=
$(
./semver
$DEFAULT_VERSION
-r
$DESIRED_VERSION
)
echo
"SATISFIED_VERSION:
$SATISFIED_VERSION
"
fi
status
"Installing dependencies with npm"
npm
install
--production
| indent
npm
install
--production
| indent
echo
"Dependencies installed"
| indent
echo
"Dependencies installed"
| indent
...
...
vendor/JSON.sh
deleted
100755 → 0
View file @
edfa6f7c
#!/usr/bin/env bash
throw
()
{
echo
"
$*
"
>
&2
exit
1
}
BRIEF
=
0
LEAFONLY
=
0
PRUNE
=
0
usage
()
{
echo
echo
"Usage: JSON.sh [-b] [-l] [-p] [-h]"
echo
echo
"-p - Prune empty. Exclude fields with empty values."
echo
"-l - Leaf only. Only show leaf nodes, which stops data duplication."
echo
"-b - Brief. Combines 'Leaf only' and 'Prune empty' options."
echo
"-h - This help text."
echo
}
parse_options
()
{
set
--
"
$@
"
local
ARGN
=
$#
while
[
$ARGN
-ne
0
]
do
case
$1
in
-h
)
usage
exit
0
;;
-b
)
BRIEF
=
1
LEAFONLY
=
1
PRUNE
=
1
;;
-l
)
LEAFONLY
=
1
;;
-p
)
PRUNE
=
1
;;
?
*
)
echo
"ERROR: Unknown option."
usage
exit
0
;;
esac
shift
1
ARGN
=
$((
ARGN-1
))
done
}
awk_egrep
()
{
local
pattern_string
=
$1
gawk
'{
while ($0) {
start=match($0, pattern);
token=substr($0, start, RLENGTH);
print token;
$0=substr($0, start+RLENGTH);
}
}'
pattern
=
$pattern_string
}
tokenize
()
{
local
GREP
local
ESCAPE
local
CHAR
if
echo
"test string"
| egrep
-ao
--color
=
never
"test"
&>/dev/null
then
GREP
=
'egrep -ao --color=never'
else
GREP
=
'egrep -ao'
fi
if
echo
"test string"
| egrep
-o
"test"
&>/dev/null
then
ESCAPE
=
'(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR
=
'[^[:cntrl:]"\\]'
else
GREP
=
awk_egrep
ESCAPE
=
'(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR
=
'[^[:cntrl:]"\\\\]'
fi
local
STRING
=
"
\"
$CHAR
*(
$ESCAPE$CHAR
*)*
\"
"
local
NUMBER
=
'-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?'
local
KEYWORD
=
'null|false|true'
local
SPACE
=
'[[:space:]]+'
$GREP
"
$STRING
|
$NUMBER
|
$KEYWORD
|
$SPACE
|."
| egrep
-v
"^
$SPACE
$"
}
parse_array
()
{
local
index
=
0
local
ary
=
''
read
-r
token
case
"
$token
"
in
']'
)
;;
*
)
while
:
do
parse_value
"
$1
"
"
$index
"
index
=
$((
index+1
))
ary
=
"
$ary
""
$value
"
read
-r
token
case
"
$token
"
in
']'
)
break
;;
','
)
ary
=
"
$ary
,"
;;
*
)
throw
"EXPECTED , or ] GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
done
;;
esac
[
"
$BRIEF
"
-eq
0
]
&&
value
=
`
printf
'[%s]'
"
$ary
"
`
||
value
=
:
}
parse_object
()
{
local
key
local
obj
=
''
read
-r
token
case
"
$token
"
in
'}'
)
;;
*
)
while
:
do
case
"
$token
"
in
'"'
*
'"'
)
key
=
$token
;;
*
)
throw
"EXPECTED string GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
case
"
$token
"
in
':'
)
;;
*
)
throw
"EXPECTED : GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
parse_value
"
$1
"
"
$key
"
obj
=
"
$obj$key
:
$value
"
read
-r
token
case
"
$token
"
in
'}'
)
break
;;
','
)
obj
=
"
$obj
,"
;;
*
)
throw
"EXPECTED , or } GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
done
;;
esac
[
"
$BRIEF
"
-eq
0
]
&&
value
=
`
printf
'{%s}'
"
$obj
"
`
||
value
=
:
}
parse_value
()
{
local
jpath
=
"
${
1
:+
$1
,
}
$2
"
isleaf
=
0
isempty
=
0
print
=
0
case
"
$token
"
in
'{'
)
parse_object
"
$jpath
"
;;
'['
)
parse_array
"
$jpath
"
;;
# At this point, the only valid single-character tokens are digits.
''
|
[!
0-9]
)
throw
"EXPECTED value GOT
${
token
:-
EOF
}
"
;;
*
)
value
=
$token
isleaf
=
1
[
"
$value
"
=
'""'
]
&&
isempty
=
1
;;
esac
[
"
$value
"
=
''
]
&&
return
[
"
$LEAFONLY
"
-eq
0
]
&&
[
"
$PRUNE
"
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
1
]
&&
[
"
$isleaf
"
-eq
1
]
&&
[
$PRUNE
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
0
]
&&
[
"
$PRUNE
"
-eq
1
]
&&
[
"
$isempty
"
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
1
]
&&
[
"
$isleaf
"
-eq
1
]
&&
\
[
$PRUNE
-eq
1
]
&&
[
$isempty
-eq
0
]
&&
print
=
1
[
"
$print
"
-eq
1
]
&&
printf
"[%s]
\t
%s
\n
"
"
$jpath
"
"
$value
"
:
}
parse
()
{
read
-r
token
parse_value
read
-r
token
case
"
$token
"
in
''
)
;;
*
)
throw
"EXPECTED EOF GOT
$token
"
;;
esac
}
parse_options
"
$@
"
if
([
"
$0
"
=
"
$BASH_SOURCE
"
]
||
!
[
-n
"
$BASH_SOURCE
"
])
;
then
tokenize | parse
fi
vendor/json
/json
→
vendor/json
View file @
eafebb02
File moved
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