From ebdd1475af631339927c92d15c6e2000d0db07d5 Mon Sep 17 00:00:00 2001 From: Thomas Gordon Date: Fri, 27 Apr 2018 16:30:40 -0400 Subject: Added Chef::Config[:clear_gem_sources] default to false Signed-off-by: Thomas Gordon --- chef-config/lib/chef-config/config.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb index d1f33d3400..d1f64d8c92 100644 --- a/chef-config/lib/chef-config/config.rb +++ b/chef-config/lib/chef-config/config.rb @@ -1086,6 +1086,9 @@ module ChefConfig # can be set to a string or array of strings for URIs to set as rubygems sources default :rubygems_url, "https://www.rubygems.org" + # globally sets the default of the clear_sources property on the gem_package and chef_gem resources + default :clear_gem_sources, false + # If installed via an omnibus installer, this gives the path to the # "embedded" directory which contains all of the software packaged with # omnibus. This is used to locate the cacert.pem file on windows. -- cgit v1.2.1 From d5100aaad308401f77586cbffebded2b8edab595 Mon Sep 17 00:00:00 2001 From: Thomas Gordon Date: Fri, 27 Apr 2018 16:31:03 -0400 Subject: Default gem_package.clear_sources to Chef::Config[:clear_gem_sources] Signed-off-by: Thomas Gordon --- lib/chef/resource/gem_package.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chef/resource/gem_package.rb b/lib/chef/resource/gem_package.rb index ee1262cb47..3a60ccf0d8 100644 --- a/lib/chef/resource/gem_package.rb +++ b/lib/chef/resource/gem_package.rb @@ -40,7 +40,7 @@ class Chef # FIXME? the array form of installing paths most likely does not work? # property :source, [ String, Array ] - property :clear_sources, [ TrueClass, FalseClass ], default: false, desired_state: false + property :clear_sources, [ TrueClass, FalseClass ], default: lazy {Chef::Config[:clear_gem_sources]}, desired_state: false # Sets a custom gem_binary to run for gem commands. property :gem_binary, String, desired_state: false -- cgit v1.2.1 From 47c9e27fb3a97814c7c1b64ac47251af0a2cde30 Mon Sep 17 00:00:00 2001 From: Thomas Gordon Date: Fri, 27 Apr 2018 16:31:20 -0400 Subject: Add test for Chef::Config[:clear_gem_sources] Signed-off-by: Thomas Gordon --- spec/unit/resource/gem_package_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/unit/resource/gem_package_spec.rb b/spec/unit/resource/gem_package_spec.rb index bee7ba9de4..a6a556c333 100644 --- a/spec/unit/resource/gem_package_spec.rb +++ b/spec/unit/resource/gem_package_spec.rb @@ -38,3 +38,16 @@ describe Chef::Resource::GemPackage, "gem_binary" do expect(resource.gem_binary).to eql("/opt/local/bin/gem") end end + +describe Chef::Resource::GemPackage, "clear_gem_sources" do + let(:resource) { Chef::Resource::GemPackage.new("foo") } + + it "is false by default" do + expect(resource.clear_sources).to be false + end + + it "sets the default of clear_sources to the config value" do + Chef::Config[:clear_gem_sources] = true + expect(resource.clear_sources).to be true + end +end -- cgit v1.2.1 From b034f7a5c3a0952266e2b1a2bb06f041bc95096f Mon Sep 17 00:00:00 2001 From: Thomas Gordon Date: Thu, 3 May 2018 12:12:47 -0400 Subject: Added Chef::Config[:clear_gem_sources] default to false (style fixes) Signed-off-by: Thomas Gordon --- chef-config/lib/chef-config/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb index d1f64d8c92..61767956ec 100644 --- a/chef-config/lib/chef-config/config.rb +++ b/chef-config/lib/chef-config/config.rb @@ -1087,7 +1087,7 @@ module ChefConfig default :rubygems_url, "https://www.rubygems.org" # globally sets the default of the clear_sources property on the gem_package and chef_gem resources - default :clear_gem_sources, false + default :clear_gem_sources, false # If installed via an omnibus installer, this gives the path to the # "embedded" directory which contains all of the software packaged with -- cgit v1.2.1 From e4ed292f15618d1b556c4ad7081afc4e1f41aa6a Mon Sep 17 00:00:00 2001 From: Thomas Gordon Date: Thu, 3 May 2018 12:13:23 -0400 Subject: Default gem_package.clear_sources to Chef::Config[:clear_gem_sources] (style fixes) Signed-off-by: Thomas Gordon --- lib/chef/resource/gem_package.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chef/resource/gem_package.rb b/lib/chef/resource/gem_package.rb index 3a60ccf0d8..f2e1867322 100644 --- a/lib/chef/resource/gem_package.rb +++ b/lib/chef/resource/gem_package.rb @@ -40,7 +40,7 @@ class Chef # FIXME? the array form of installing paths most likely does not work? # property :source, [ String, Array ] - property :clear_sources, [ TrueClass, FalseClass ], default: lazy {Chef::Config[:clear_gem_sources]}, desired_state: false + property :clear_sources, [ TrueClass, FalseClass ], default: lazy { Chef::Config[:clear_gem_sources] }, desired_state: false # Sets a custom gem_binary to run for gem commands. property :gem_binary, String, desired_state: false -- cgit v1.2.1