Skip to content
Browse files

Merge pull request #305 from heroku/blacklist-lang

test and implementation for blacklisting LANG; fixed failure tests
  • Loading branch information...
2 parents b5d7dfc + 14b6eb0 commit c5db0676a61341547bf70032ce7016b04d7c7956 @hunterloftis hunterloftis committed Apr 20, 2016
Showing with 31 additions and 4 deletions.
  1. +1 −1 lib/environment.sh
  2. +3 −3 lib/failure.sh
  3. +16 −0 test/fixtures/echo-lang/package.json
  4. +11 −0 test/run
View
2 lib/environment.sh
@@ -21,7 +21,7 @@ export_env_dir() {
local env_dir=$1
if [ -d "$env_dir" ]; then
local whitelist_regex=${2:-''}
- local blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)$'}
+ local blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH|LANG)$'}
if [ -d "$env_dir" ]; then
for e in $(ls $env_dir); do
echo "$e" | grep -E "$whitelist_regex" | grep -qvE "$blacklist_regex" &&
View
6 lib/failure.sh
@@ -70,13 +70,13 @@ warn_old_npm() {
warn_untracked_dependencies() {
local log_file="$1"
- if grep -qi 'gulp: not found' "$log_file"; then
+ if grep -qi 'gulp: not found' "$log_file" || grep -qi 'gulp: command not found' "$log_file"; then
warning "Gulp may not be tracked in package.json" "https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies"
fi
- if grep -qi 'grunt: not found' "$log_file"; then
+ if grep -qi 'grunt: not found' "$log_file" || grep -qi 'grunt: command not found' "$log_file"; then
warning "Grunt may not be tracked in package.json" "https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies"
fi
- if grep -qi 'bower: not found' "$log_file"; then
+ if grep -qi 'bower: not found' "$log_file" || grep -qi 'bower: command not found' "$log_file"; then
warning "Bower may not be tracked in package.json" "https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies"
fi
}
View
16 test/fixtures/echo-lang/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "echo-lang",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "repository" : {
+ "type" : "git",
+ "url" : "http://github.com/example/example.git"
+ },
+ "scripts": {
+ "postinstall": "echo $LANG; echo $SAFE;"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC"
+}
View
11 test/run
@@ -1,6 +1,17 @@
#!/usr/bin/env bash
# See README.md for info on running these tests.
+testEnvBlacklist() {
+ local cache=$(mktmpdir)
+ local env_dir=$(mktmpdir)
+ echo 'tr_TR.UTF-8' > "$env_dir"/LANG
+ echo 'safeVar' > "$env_dir"/SAFE
+ compile "echo-lang" $cache $env_dir
+ assertCaptured "safeVar"
+ assertNotCaptured "tr_TR.UTF-8"
+ assertCapturedSuccess
+}
+
testPrePostBuildScripts() {
compile "pre-post-build-scripts"
assertCaptured "Running heroku-prebuild"

0 comments on commit c5db067

Please sign in to comment.
Something went wrong with that request. Please try again.