summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-10-09 10:49:10 -0700
committerGitHub <noreply@github.com>2019-10-09 10:49:10 -0700
commitc116aa571649006b33a421785f1733178fd05de1 (patch)
treec5979b54493c453063b1a4817a4d2ba7ff1ab658
parent81373edc4aa457915f644ae882405b6041843010 (diff)
parent4ba353f55c3a79016b158eb0ac9729b9e03d393c (diff)
downloadchef-c116aa571649006b33a421785f1733178fd05de1.tar.gz
Merge pull request #8974 from chef/fix_8901
Modify #8901 to not use arrays with mixlib-shellout
-rw-r--r--.gitignore4
-rw-r--r--lib/chef/cookbook/gem_installer.rb3
-rw-r--r--spec/unit/cookbook/gem_installer_spec.rb4
3 files changed, 8 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index ac14a13e8e..2ee48bb270 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ tags
*~
.chef
results
+*.gem
# You should check in your Gemfile.lock in applications, and not in gems
external_tests/*.lock
@@ -61,3 +62,6 @@ nodes/
# chef-config
chef-config/.bundle
chef-config/Gemfile.lock
+
+# docs site generation from master
+docs_site/**
diff --git a/lib/chef/cookbook/gem_installer.rb b/lib/chef/cookbook/gem_installer.rb
index 4b871b33b4..81181b2ff2 100644
--- a/lib/chef/cookbook/gem_installer.rb
+++ b/lib/chef/cookbook/gem_installer.rb
@@ -69,7 +69,8 @@ class Chef
# Skip installation only if Chef::Config[:skip_gem_metadata_installation] option is true
unless Chef::Config[:skip_gem_metadata_installation]
# Add additional options to bundle install
- cmd = [ "bundle", "install", Chef::Config[:gem_installer_bundler_options] ]
+ cmd = "bundle install"
+ cmd += " #{Chef::Config[:gem_installer_bundler_options]}" if Chef::Config[:gem_installer_bundler_options]
so = shell_out!(cmd, cwd: dir, env: { "PATH" => path_with_prepended_ruby_bin })
Chef::Log.info(so.stdout)
end
diff --git a/spec/unit/cookbook/gem_installer_spec.rb b/spec/unit/cookbook/gem_installer_spec.rb
index 858710d952..efe12c9dbe 100644
--- a/spec/unit/cookbook/gem_installer_spec.rb
+++ b/spec/unit/cookbook/gem_installer_spec.rb
@@ -1,5 +1,5 @@
require "spec_helper"
-require "bundler/dsl"
+require "bundler"
describe Chef::Cookbook::GemInstaller do
let(:cookbook_collection) do
@@ -106,7 +106,7 @@ describe Chef::Cookbook::GemInstaller do
it "install from local cache when Chef::Config[:gem_installer_bundler_options] is set to local" do
Chef::Config[:gem_installer_bundler_options] = "--local"
- expect(gem_installer).to receive(:shell_out!).with(["bundle", "install", "--local"], any_args).and_return(shell_out)
+ expect(gem_installer).to receive(:shell_out!).with("bundle install --local", any_args).and_return(shell_out)
expect(Chef::Log).to receive(:info).and_return("")
expect(gem_installer.install).to be_empty
end