summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2019-10-09 10:33:54 -0700
committerTim Smith <tsmith84@gmail.com>2019-10-09 10:33:54 -0700
commit4ba353f55c3a79016b158eb0ac9729b9e03d393c (patch)
treec5979b54493c453063b1a4817a4d2ba7ff1ab658
parent81373edc4aa457915f644ae882405b6041843010 (diff)
downloadchef-4ba353f55c3a79016b158eb0ac9729b9e03d393c.tar.gz
Modify #8901 to not use arrays with mixlib-shellout
Chef-14 has to work with mixlib-shellout 2.x which does not support the array form of shelling out. Use a string instead. I also updated the gitignore to avoid some junk coming in and swapped the spec's bundler require to be the full bundler gem since it needs a giant pile of stuff in Bundler and bundler doesn't have proper requires in the DSL class to make that happen. Signed-off-by: Tim Smith <tsmith@chef.io>
-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