Skip to content

Commit

Permalink
Fix [ -z $var clauses without quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
native-api committed Feb 7, 2020
1 parent e1ad6c0 commit acb15ea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/dpl/provider/atlas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/dpl/provider/pypi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions spec/provider/pypi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit acb15ea

Please sign in to comment.