From acb15ea8e096b242899f96a9894a2efee0b98977 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Fri, 7 Feb 2020 04:14:33 +0300 Subject: [PATCH] Fix `[ -z $var` clauses without quotes --- lib/dpl/provider/atlas.rb | 2 +- lib/dpl/provider/pypi.rb | 2 +- spec/provider/pypi_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dpl/provider/atlas.rb b/lib/dpl/provider/atlas.rb index c51d6d707..198649f09 100644 --- a/lib/dpl/provider/atlas.rb +++ b/lib/dpl/provider/atlas.rb @@ -16,7 +16,7 @@ class Atlas < Provider chmod +x $HOME/bin/gimme fi - if [ -z $GOPATH ]; then + if [ -z "$GOPATH" ]; then export GOPATH="$HOME/gopath" else export GOPATH="$HOME/gopath:$GOPATH" diff --git a/lib/dpl/provider/pypi.rb b/lib/dpl/provider/pypi.rb index 730c7ccf7..e6501c633 100644 --- a/lib/dpl/provider/pypi.rb +++ b/lib/dpl/provider/pypi.rb @@ -67,7 +67,7 @@ def pypi_wheel_arg def install_deploy_dependencies # --user likely fails inside virtualenvs but is needed outside to avoid needing sudo. - unless context.shell "if [ -z ${VIRTUAL_ENV+x} ]; then export PIP_USER=yes; fi && " \ + unless context.shell "if [ -z \"${VIRTUAL_ENV}\" ]; then export PIP_USER=yes; fi && " \ "wget -nv -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && " \ "pip install --upgrade #{pypi_setuptools_arg} #{pypi_twine_arg} #{pypi_wheel_arg}" error "Couldn't install pip, setuptools, twine or wheel." diff --git a/spec/provider/pypi_spec.rb b/spec/provider/pypi_spec.rb index 732053587..a7aebc781 100644 --- a/spec/provider/pypi_spec.rb +++ b/spec/provider/pypi_spec.rb @@ -9,7 +9,7 @@ describe "#install_deploy_dependencies" do example do expect(provider.context).to receive(:shell).with( - "if [ -z ${VIRTUAL_ENV+x} ]; then export PIP_USER=yes; fi && wget -nv -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && pip install --upgrade setuptools twine wheel" + "if [ -z \"${VIRTUAL_ENV}\" ]; then export PIP_USER=yes; fi && wget -nv -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && pip install --upgrade setuptools twine wheel" ).and_return(true) provider.install_deploy_dependencies end @@ -21,7 +21,7 @@ provider.options.update(:twine_version => '1.1.0') provider.options.update(:wheel_version => '0.1.0') expect(provider.context).to receive(:shell).with( - "if [ -z ${VIRTUAL_ENV+x} ]; then export PIP_USER=yes; fi && wget -nv -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && pip install --upgrade setuptools==1.0.1 twine==1.1.0 wheel==0.1.0" + "if [ -z \"${VIRTUAL_ENV}\" ]; then export PIP_USER=yes; fi && wget -nv -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && pip install --upgrade setuptools==1.0.1 twine==1.1.0 wheel==0.1.0" ).and_return(true) provider.install_deploy_dependencies end