Commit 7df64870 authored by Robin Richtsfeld's avatar Robin Richtsfeld Committed by Jeremy Morrell

More shell cleaning (#554)

parent 2c3db890
...@@ -16,7 +16,7 @@ BPLOG_PREFIX="buildpack.nodejs" ...@@ -16,7 +16,7 @@ BPLOG_PREFIX="buildpack.nodejs"
BUILD_DIR=${1:-} BUILD_DIR=${1:-}
CACHE_DIR=${2:-} CACHE_DIR=${2:-}
ENV_DIR=${3:-} ENV_DIR=${3:-}
BP_DIR=$(cd $(dirname ${0:-}); cd ..; pwd) BP_DIR=$(cd "$(dirname ${0:-})"; cd ..; pwd)
STDLIB_FILE=$(mktemp -t stdlib.XXXXX) STDLIB_FILE=$(mktemp -t stdlib.XXXXX)
### Load dependencies ### Load dependencies
...@@ -111,13 +111,16 @@ install_bins() { ...@@ -111,13 +111,16 @@ install_bins() {
if [ -n "$iojs_engine" ]; then if [ -n "$iojs_engine" ]; then
warn_node_engine "$iojs_engine" warn_node_engine "$iojs_engine"
install_iojs "$iojs_engine" "$BUILD_DIR/.heroku/node" install_iojs "$iojs_engine" "$BUILD_DIR/.heroku/node"
echo "Using bundled npm version for iojs compatibility: `npm --version`" local npm_version="$(npm --version)"
mcount "version.iojs.$(node --version)" local node_version="$(node --version)"
echo "Using bundled npm version for iojs compatibility: $npm_version"
mcount "version.iojs.$node_version"
else else
warn_node_engine "$node_engine" warn_node_engine "$node_engine"
install_nodejs "$node_engine" "$BUILD_DIR/.heroku/node" install_nodejs "$node_engine" "$BUILD_DIR/.heroku/node"
install_npm "$npm_engine" "$BUILD_DIR/.heroku/node" $NPM_LOCK install_npm "$npm_engine" "$BUILD_DIR/.heroku/node" $NPM_LOCK
mcount "version.node.$(node --version)" local node_version="$(node --version)"
mcount "version.node.$node_version"
fi fi
# Download yarn if there is a yarn.lock file or if the user # Download yarn if there is a yarn.lock file or if the user
...@@ -209,7 +212,7 @@ header "Building dependencies" | output "$LOG_FILE" ...@@ -209,7 +212,7 @@ header "Building dependencies" | output "$LOG_FILE"
build_dependencies | output "$LOG_FILE" build_dependencies | output "$LOG_FILE"
cache_build() { cache_build() {
local cache_directories=$(get_cache_directories) local cache_directories="$(get_cache_directories)"
clear_cache clear_cache
if ! ${NODE_MODULES_CACHE:-true}; then if ! ${NODE_MODULES_CACHE:-true}; then
......
#!/usr/bin/env bash #!/usr/bin/env bash
BP_DIR=$(cd $(dirname ${0:-}); cd ..; pwd) BP_DIR=$(cd "$(dirname ${0:-})"; cd ..; pwd)
source $BP_DIR/lib/environment.sh source $BP_DIR/lib/environment.sh
......
...@@ -79,14 +79,14 @@ install_npm() { ...@@ -79,14 +79,14 @@ install_npm() {
fi fi
if [ "$version" == "" ]; then if [ "$version" == "" ]; then
echo "Using default npm version: `npm --version`" echo "Using default npm version: $npm_version"
elif [[ `npm --version` == "$version" ]]; then elif [[ "$npm_version" == "$version" ]]; then
echo "npm `npm --version` already installed with node" echo "npm $npm_version already installed with node"
else else
echo "Bootstrapping npm $version (replacing `npm --version`)..." echo "Bootstrapping npm $version (replacing $npm_version)..."
if ! npm install --unsafe-perm --quiet -g "npm@$version" 2>@1>/dev/null; then if ! npm install --unsafe-perm --quiet -g "npm@$version" 2>@1>/dev/null; then
echo "Unable to install npm $version; does it exist?" && false echo "Unable to install npm $version; does it exist?" && false
fi fi
echo "npm `npm --version` installed" echo "npm $version installed"
fi fi
} }
...@@ -5,7 +5,7 @@ create_signature() { ...@@ -5,7 +5,7 @@ create_signature() {
} }
save_signature() { save_signature() {
echo "$(create_signature)" > $CACHE_DIR/node/signature create_signature > $CACHE_DIR/node/signature
} }
load_signature() { load_signature() {
...@@ -48,7 +48,7 @@ restore_default_cache_directories() { ...@@ -48,7 +48,7 @@ restore_default_cache_directories() {
echo "- node_modules is checked into source control and cannot be cached" echo "- node_modules is checked into source control and cannot be cached"
elif [[ -e "$cache_dir/node/node_modules" ]]; then elif [[ -e "$cache_dir/node/node_modules" ]]; then
echo "- node_modules" echo "- node_modules"
mkdir -p $(dirname "$build_dir/node_modules") mkdir -p "$(dirname "$build_dir/node_modules")"
mv "$cache_dir/node/node_modules" "$build_dir/node_modules" mv "$cache_dir/node/node_modules" "$build_dir/node_modules"
else else
echo "- node_modules (not cached - skipping)" echo "- node_modules (not cached - skipping)"
...@@ -63,17 +63,17 @@ restore_default_cache_directories() { ...@@ -63,17 +63,17 @@ restore_default_cache_directories() {
restore_custom_cache_directories() { restore_custom_cache_directories() {
local build_dir=${1:-} local build_dir=${1:-}
local cache_dir=${2:-} local cache_dir=${2:-}
local cache_directories="${@:3}" local cache_directories=("${@:3}")
echo "Loading $(echo $cache_directories | wc -w | xargs) from cacheDirectories (package.json):" echo "Loading ${#cache_directories[@]} from cacheDirectories (package.json):"
for cachepath in ${@:3}; do for cachepath in "${cache_directories[@]}"; do
if [ -e "$build_dir/$cachepath" ]; then if [ -e "$build_dir/$cachepath" ]; then
echo "- $cachepath (exists - skipping)" echo "- $cachepath (exists - skipping)"
else else
if [ -e "$cache_dir/node/$cachepath" ]; then if [ -e "$cache_dir/node/$cachepath" ]; then
echo "- $cachepath" echo "- $cachepath"
mkdir -p $(dirname "$build_dir/$cachepath") mkdir -p "$(dirname "$build_dir/$cachepath")"
mv "$cache_dir/node/$cachepath" "$build_dir/$cachepath" mv "$cache_dir/node/$cachepath" "$build_dir/$cachepath"
else else
echo "- $cachepath (not cached - skipping)" echo "- $cachepath (not cached - skipping)"
...@@ -95,7 +95,7 @@ save_default_cache_directories() { ...@@ -95,7 +95,7 @@ save_default_cache_directories() {
if [[ -e "$build_dir/node_modules" ]]; then if [[ -e "$build_dir/node_modules" ]]; then
echo "- node_modules" echo "- node_modules"
mkdir -p "$cache_dir/node/node_modules" mkdir -p "$cache_dir/node/node_modules"
cp -a "$build_dir/node_modules" $(dirname "$cache_dir/node/node_modules") cp -a "$build_dir/node_modules" "$(dirname "$cache_dir/node/node_modules")"
else else
# this can happen if there are no dependencies # this can happen if there are no dependencies
mcount "cache.no-node-modules" mcount "cache.no-node-modules"
...@@ -107,22 +107,22 @@ save_default_cache_directories() { ...@@ -107,22 +107,22 @@ save_default_cache_directories() {
mcount "cache.saved-bower-components" mcount "cache.saved-bower-components"
echo "- bower_components" echo "- bower_components"
mkdir -p "$cache_dir/node/bower_components" mkdir -p "$cache_dir/node/bower_components"
cp -a "$build_dir/bower_components" $(dirname "$cache_dir/node/bower_components") cp -a "$build_dir/bower_components" "$(dirname "$cache_dir/node/bower_components")"
fi fi
} }
save_custom_cache_directories() { save_custom_cache_directories() {
local build_dir=${1:-} local build_dir=${1:-}
local cache_dir=${2:-} local cache_dir=${2:-}
local cache_directories="${@:3}" local cache_directories=("${@:3}")
echo "Saving $(echo $cache_directories | wc -w | xargs) cacheDirectories (package.json):" echo "Saving ${#cache_directories[@]} cacheDirectories (package.json):"
for cachepath in ${@:3}; do for cachepath in "${cache_directories[@]}"; do
if [ -e "$build_dir/$cachepath" ]; then if [ -e "$build_dir/$cachepath" ]; then
echo "- $cachepath" echo "- $cachepath"
mkdir -p "$cache_dir/node/$cachepath" mkdir -p "$cache_dir/node/$cachepath"
cp -a "$build_dir/$cachepath" $(dirname "$cache_dir/node/$cachepath") cp -a "$build_dir/$cachepath" "$(dirname "$cache_dir/node/$cachepath")"
else else
echo "- $cachepath (nothing to cache)" echo "- $cachepath (nothing to cache)"
fi fi
......
measure_size() { measure_size() {
echo "$((du -s node_modules 2>/dev/null || echo 0) | awk '{print $1}')" (du -s node_modules 2>/dev/null || echo 0) | awk '{print $1}'
} }
list_dependencies() { list_dependencies() {
......
...@@ -54,13 +54,14 @@ export_env_dir() { ...@@ -54,13 +54,14 @@ export_env_dir() {
if [ -d "$env_dir" ]; then if [ -d "$env_dir" ]; then
local whitelist_regex=${2:-''} local whitelist_regex=${2:-''}
local blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH|LANG|BUILD_DIR)$'} local blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH|LANG|BUILD_DIR)$'}
if [ -d "$env_dir" ]; then pushd "$env_dir" >/dev/null
for e in $(ls $env_dir); do for e in *; do
echo "$e" | grep -E "$whitelist_regex" | grep -qvE "$blacklist_regex" && [ -e "$e" ] || continue
export "$e=$(cat $env_dir/$e)" echo "$e" | grep -E "$whitelist_regex" | grep -qvE "$blacklist_regex" &&
: export "$e=$(cat $e)"
done :
fi done
popd >/dev/null
fi fi
} }
......
...@@ -450,9 +450,11 @@ log_other_failures() { ...@@ -450,9 +450,11 @@ log_other_failures() {
warning() { warning() {
local tip=${1:-} local tip=${1:-}
local url=${2:-https://devcenter.heroku.com/articles/nodejs-support} local url=${2:-https://devcenter.heroku.com/articles/nodejs-support}
echo "- $tip" >> $warnings {
echo " $url" >> $warnings echo "- $tip"
echo "" >> $warnings echo " $url"
echo ""
} >> $warnings
} }
warn() { warn() {
......
...@@ -20,7 +20,7 @@ detect_memory() { ...@@ -20,7 +20,7 @@ detect_memory() {
local default=$1 local default=$1
if [ -e /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then if [ -e /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then
expr "$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)" / 1048576 echo $(($(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) / 1048576))
else else
echo "$default" echo "$default"
fi fi
......
#!/usr/bin/env bash #!/usr/bin/env bash
source $(pwd)/lib/environment.sh source "$(pwd)"/lib/environment.sh
mktmpdir() { mktmpdir() {
local dir=$(mktemp -t testXXXXX) local dir=$(mktemp -t testXXXXX)
...@@ -18,7 +18,7 @@ compile() { ...@@ -18,7 +18,7 @@ compile() {
echo "Compiling $fixture" echo "Compiling $fixture"
echo "in $build_dir" echo "in $build_dir"
echo "(caching in $cache_dir)" echo "(caching in $cache_dir)"
cp -a $(pwd)/* ${bp_dir} cp -a "$(pwd)"/* ${bp_dir}
cp -a ${bp_dir}/test/fixtures/$fixture/. ${build_dir} cp -a ${bp_dir}/test/fixtures/$fixture/. ${build_dir}
"$bp_dir/bin/compile" "$build_dir" "$cache_dir" "$bp_dir/bin/compile" "$build_dir" "$cache_dir"
} }
...@@ -32,7 +32,7 @@ compileTest() { ...@@ -32,7 +32,7 @@ compileTest() {
echo "Compiling $fixture" echo "Compiling $fixture"
echo "in $build_dir" echo "in $build_dir"
echo "(caching in $cache_dir)" echo "(caching in $cache_dir)"
cp -a $(pwd)/* ${bp_dir} cp -a "$(pwd)"/* ${bp_dir}
cp -a ${bp_dir}/test/fixtures/$fixture/. ${build_dir} cp -a ${bp_dir}/test/fixtures/$fixture/. ${build_dir}
"$bp_dir/bin/test-compile" "$build_dir" "$cache_dir" "$bp_dir/bin/test-compile" "$build_dir" "$cache_dir"
......
...@@ -23,7 +23,7 @@ testDisableCache() { ...@@ -23,7 +23,7 @@ testDisableCache() {
echo "true" > $env_dir/NODE_VERBOSE echo "true" > $env_dir/NODE_VERBOSE
compile "node-modules-cache-1" $cache $env_dir compile "node-modules-cache-1" $cache $env_dir
assertCaptured "lodash@1.0.0" assertCaptured "lodash@1.0.0"
assertEquals "1" "$(ls -1 $cache/node/node_modules | grep lodash | wc -l | tr -d ' ')" assertEquals "1" "$(ls -1 $cache/node/node_modules | grep -c lodash | tr -d ' ')"
assertCapturedSuccess assertCapturedSuccess
compile "node-modules-cache-2" $cache $env_dir compile "node-modules-cache-2" $cache $env_dir
...@@ -41,7 +41,7 @@ testNodeModulesCached() { ...@@ -41,7 +41,7 @@ testNodeModulesCached() {
compile "caching" $cache compile "caching" $cache
assertCaptured "- node_modules" assertCaptured "- node_modules"
assertEquals "1" "$(ls -1 $cache/node/node_modules | grep express | wc -l | tr -d ' ')" assertEquals "1" "$(ls -1 $cache/node/node_modules | grep -c express | tr -d ' ')"
assertCapturedSuccess assertCapturedSuccess
} }
...@@ -95,7 +95,7 @@ testBuildWithCache() { ...@@ -95,7 +95,7 @@ testBuildWithCache() {
compile "stable-node" $cache compile "stable-node" $cache
assertNotCaptured "Restoring cache" assertNotCaptured "Restoring cache"
assertEquals "1" "$(ls -1 $cache/node/node_modules | grep hashish | wc -l | tr -d ' ')" assertEquals "1" "$(ls -1 $cache/node/node_modules | grep -c hashish | tr -d ' ')"
assertCapturedSuccess assertCapturedSuccess
compile "stable-node" $cache compile "stable-node" $cache
...@@ -369,8 +369,8 @@ testBuildWithUserCacheDirectoriesCamel() { ...@@ -369,8 +369,8 @@ testBuildWithUserCacheDirectoriesCamel() {
compile "cache-directories-camel" $cache compile "cache-directories-camel" $cache
assertCaptured "- non/existent (nothing to cache)" assertCaptured "- non/existent (nothing to cache)"
assertEquals "1" "$(ls -1 $cache/node/server | grep node_modules | wc -l | tr -d ' ')" assertEquals "1" "$(ls -1 $cache/node/server | grep -c node_modules | tr -d ' ')"
assertEquals "1" "$(ls -1 $cache/node/client | grep node_modules | wc -l | tr -d ' ')" assertEquals "1" "$(ls -1 $cache/node/client | grep -c node_modules | tr -d ' ')"
assertCapturedSuccess assertCapturedSuccess
compile "cache-directories-camel" $cache compile "cache-directories-camel" $cache
...@@ -382,35 +382,35 @@ testBuildWithUserCacheDirectoriesCamel() { ...@@ -382,35 +382,35 @@ testBuildWithUserCacheDirectoriesCamel() {
} }
testConcurrency1X() { testConcurrency1X() {
LOG_CONCURRENCY=true MEMORY_AVAILABLE=512 capture $(pwd)/profile/WEB_CONCURRENCY.sh LOG_CONCURRENCY=true MEMORY_AVAILABLE=512 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
assertCaptured "Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)" assertCaptured "Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured "Recommending WEB_CONCURRENCY=1" assertCaptured "Recommending WEB_CONCURRENCY=1"
assertCapturedSuccess assertCapturedSuccess
} }
testConcurrency2X() { testConcurrency2X() {
LOG_CONCURRENCY=true MEMORY_AVAILABLE=1024 capture $(pwd)/profile/WEB_CONCURRENCY.sh LOG_CONCURRENCY=true MEMORY_AVAILABLE=1024 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
assertCaptured "Detected 1024 MB available memory, 512 MB limit per process (WEB_MEMORY)" assertCaptured "Detected 1024 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured "Recommending WEB_CONCURRENCY=2" assertCaptured "Recommending WEB_CONCURRENCY=2"
assertCapturedSuccess assertCapturedSuccess
} }
testConcurrencyPerformanceM() { testConcurrencyPerformanceM() {
LOG_CONCURRENCY=true MEMORY_AVAILABLE=2560 capture $(pwd)/profile/WEB_CONCURRENCY.sh LOG_CONCURRENCY=true MEMORY_AVAILABLE=2560 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
assertCaptured "Detected 2560 MB available memory, 512 MB limit per process (WEB_MEMORY)" assertCaptured "Detected 2560 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured "Recommending WEB_CONCURRENCY=5" assertCaptured "Recommending WEB_CONCURRENCY=5"
assertCapturedSuccess assertCapturedSuccess
} }
testConcurrencyPerformanceL() { testConcurrencyPerformanceL() {
LOG_CONCURRENCY=true MEMORY_AVAILABLE=14336 capture $(pwd)/profile/WEB_CONCURRENCY.sh LOG_CONCURRENCY=true MEMORY_AVAILABLE=14336 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
assertCaptured "Detected 14336 MB available memory, 512 MB limit per process (WEB_MEMORY)" assertCaptured "Detected 14336 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured "Recommending WEB_CONCURRENCY=28" assertCaptured "Recommending WEB_CONCURRENCY=28"
assertCapturedSuccess assertCapturedSuccess
} }
testConcurrencyCustomLimit() { testConcurrencyCustomLimit() {
LOG_CONCURRENCY=true MEMORY_AVAILABLE=1024 WEB_MEMORY=256 capture $(pwd)/profile/WEB_CONCURRENCY.sh LOG_CONCURRENCY=true MEMORY_AVAILABLE=1024 WEB_MEMORY=256 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
assertCaptured "Detected 1024 MB available memory, 256 MB limit per process (WEB_MEMORY)" assertCaptured "Detected 1024 MB available memory, 256 MB limit per process (WEB_MEMORY)"
assertCaptured "Recommending WEB_CONCURRENCY=4" assertCaptured "Recommending WEB_CONCURRENCY=4"
assertCapturedSuccess assertCapturedSuccess
...@@ -419,7 +419,7 @@ testConcurrencyCustomLimit() { ...@@ -419,7 +419,7 @@ testConcurrencyCustomLimit() {
# When /sys/fs/cgroup/memory/memory.limit_in_bytes lies and gives a ridiculous value # When /sys/fs/cgroup/memory/memory.limit_in_bytes lies and gives a ridiculous value
# This happens on Dokku for example # This happens on Dokku for example
testConcurrencyTooHigh() { testConcurrencyTooHigh() {
LOG_CONCURRENCY=true MEMORY_AVAILABLE=10000000000 capture $(pwd)/profile/WEB_CONCURRENCY.sh LOG_CONCURRENCY=true MEMORY_AVAILABLE=10000000000 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
assertCaptured "Could not determine a reasonable value for WEB_CONCURRENCY" assertCaptured "Could not determine a reasonable value for WEB_CONCURRENCY"
assertCaptured "Recommending WEB_CONCURRENCY=1" assertCaptured "Recommending WEB_CONCURRENCY=1"
assertCapturedSuccess assertCapturedSuccess
...@@ -614,8 +614,8 @@ testBuildWithUserCacheDirectories() { ...@@ -614,8 +614,8 @@ testBuildWithUserCacheDirectories() {
compile "cache-directories" $cache compile "cache-directories" $cache
assertCaptured "Saving 2 cacheDirectories" assertCaptured "Saving 2 cacheDirectories"
assertEquals "1" "$(ls -1 $cache/node | grep bower_components | wc -l | tr -d ' ')" assertEquals "1" "$(ls -1 $cache/node | grep -c bower_components | tr -d ' ')"
assertEquals "1" "$(ls -1 $cache/node | grep node_modules | wc -l | tr -d ' ')" assertEquals "1" "$(ls -1 $cache/node | grep -c node_modules | tr -d ' ')"
assertCapturedSuccess assertCapturedSuccess
compile "cache-directories" $cache compile "cache-directories" $cache
...@@ -967,11 +967,11 @@ testPluginInstallationUnsupportedNodeRunTime() { ...@@ -967,11 +967,11 @@ testPluginInstallationUnsupportedNodeRunTime() {
# Utils # Utils
pushd $(dirname 0) >/dev/null pushd "$(dirname 0)" >/dev/null
popd >/dev/null popd >/dev/null
source $(pwd)/test/utils source "$(pwd)"/test/utils
source $(pwd)/lib/environment.sh source "$(pwd)"/lib/environment.sh
mktmpdir() { mktmpdir() {
dir=$(mktemp -t testXXXXX) dir=$(mktemp -t testXXXXX)
...@@ -981,7 +981,7 @@ mktmpdir() { ...@@ -981,7 +981,7 @@ mktmpdir() {
} }
detect() { detect() {
capture $(pwd)/bin/detect $(pwd)/test/fixtures/$1 capture "$(pwd)"/bin/detect "$(pwd)"/test/fixtures/$1
} }
compile_dir="" compile_dir=""
...@@ -997,7 +997,7 @@ compile() { ...@@ -997,7 +997,7 @@ compile() {
default_process_types_cleanup default_process_types_cleanup
bp_dir=$(mktmpdir) bp_dir=$(mktmpdir)
compile_dir=$(mktmpdir) compile_dir=$(mktmpdir)
cp -a $(pwd)/* ${bp_dir} cp -a "$(pwd)"/* ${bp_dir}
cp -a ${bp_dir}/test/fixtures/$1/. ${compile_dir} cp -a ${bp_dir}/test/fixtures/$1/. ${compile_dir}
capture ${bp_dir}/bin/compile ${compile_dir} ${2:-$(mktmpdir)} $3 capture ${bp_dir}/bin/compile ${compile_dir} ${2:-$(mktmpdir)} $3
} }
...@@ -1036,7 +1036,7 @@ compileTest() { ...@@ -1036,7 +1036,7 @@ compileTest() {
local cache_dir=${2:-$(mktmpdir)} local cache_dir=${2:-$(mktmpdir)}
local env_dir=$3 local env_dir=$3
cp -a $(pwd)/* ${bp_dir} cp -a "$(pwd)"/* ${bp_dir}
cp -a ${bp_dir}/test/fixtures/$1/. ${compile_dir} cp -a ${bp_dir}/test/fixtures/$1/. ${compile_dir}
capture ${bp_dir}/bin/test-compile ${compile_dir} ${2:-$(mktmpdir)} $3 capture ${bp_dir}/bin/test-compile ${compile_dir} ${2:-$(mktmpdir)} $3
...@@ -1065,13 +1065,13 @@ compileDir() { ...@@ -1065,13 +1065,13 @@ compileDir() {
local cache_dir=${2:-$(mktmpdir)} local cache_dir=${2:-$(mktmpdir)}
local env_dir=$3 local env_dir=$3
cp -a $(pwd)/* ${bp_dir} cp -a "$(pwd)"/* ${bp_dir}
capture ${bp_dir}/bin/compile ${compile_dir} ${cache_dir} ${env_dir} capture ${bp_dir}/bin/compile ${compile_dir} ${cache_dir} ${env_dir}
} }
release() { release() {
bp_dir=$(mktmpdir) bp_dir=$(mktmpdir)
cp -a $(pwd)/* ${bp_dir} cp -a "$(pwd)"/* ${bp_dir}
capture ${bp_dir}/bin/release ${bp_dir}/test/fixtures/$1 capture ${bp_dir}/bin/release ${bp_dir}/test/fixtures/$1
} }
...@@ -1079,4 +1079,4 @@ assertFile() { ...@@ -1079,4 +1079,4 @@ assertFile() {
assertEquals "$1" "$(cat ${compile_dir}/$2)" assertEquals "$1" "$(cat ${compile_dir}/$2)"
} }
source $(pwd)/test/shunit2 source "$(pwd)"/test/shunit2
...@@ -186,7 +186,7 @@ assertFileMD5() ...@@ -186,7 +186,7 @@ assertFileMD5()
fail "no suitable MD5 hashing command found on this system" fail "no suitable MD5 hashing command found on this system"
fi fi
assertEquals "${expected_md5_cmd_output}" "`${md5_cmd}`" assertEquals "${expected_md5_cmd_output}" "$(${md5_cmd})"
} }
assertDirectoryExists() { assertDirectoryExists() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment