diff options
author | Thom May <thom@may.lt> | 2015-08-13 14:50:02 +0100 |
---|---|---|
committer | Thom May <thom@may.lt> | 2015-08-13 14:50:02 +0100 |
commit | 21fc71a1176c3eeb73f10ca709379f9a5d6ec843 (patch) | |
tree | ea640d596c85ab1db1ff626b88151b54cbb069ae | |
parent | 178b46fad5949d9e19f5099bc058ed5cb3977235 (diff) | |
parent | d27a5f8257eed6383f33acd0ab2f07655a69da19 (diff) | |
download | chef-21fc71a1176c3eeb73f10ca709379f9a5d6ec843.tar.gz |
Merge pull request #3383 from jfly/master
gem_package should install to the systemwide Ruby when using ChefDK.
-rw-r--r-- | lib/chef/provider/package/rubygems.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/package/rubygems_spec.rb | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index b5f7dbdd80..729f755b2a 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -394,7 +394,7 @@ class Chef end def is_omnibus? - if RbConfig::CONFIG['bindir'] =~ %r!/opt/(opscode|chef)/embedded/bin! + if RbConfig::CONFIG['bindir'] =~ %r!/(opscode|chef|chefdk)/embedded/bin! Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}") # Omnibus installs to a static path because of linking on unix, find it. true diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index 67ffb7bb9e..f790bdb1ce 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -369,6 +369,24 @@ describe Chef::Provider::Package::Rubygems do expect(provider.gem_env.gem_binary_location).to eq('/usr/weird/bin/gem') end + it "recognizes chef as omnibus" do + allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chef/embedded/bin") + provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) + expect(provider.is_omnibus?).to be true + end + + it "recognizes opscode as omnibus" do + allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/opscode/embedded/bin") + provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) + expect(provider.is_omnibus?).to be true + end + + it "recognizes chefdk as omnibus" do + allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chefdk/embedded/bin") + provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context) + expect(provider.is_omnibus?).to be true + end + it "searches for a gem binary when running on Omnibus on Unix" do platform_mock :unix do allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chef/embedded/bin") |