summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-02 10:36:36 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-09 09:16:06 -0800
commit1d063284f755b996a6563d7210496afd716a9f2d (patch)
tree52d7ad076704b5ca12c62d02933827a85e4a9801
parentaa74c0ac58393e9186c2ebecbc3144c2c8d2ee85 (diff)
downloadchef-1d063284f755b996a6563d7210496afd716a9f2d.tar.gz
make rubygems.org configurable
for bonus points gem_package will pick this up as well.
-rw-r--r--chef-config/lib/chef-config/config.rb2
-rw-r--r--lib/chef/cookbook/gem_installer.rb2
-rw-r--r--lib/chef/provider/package/rubygems.rb2
3 files changed, 4 insertions, 2 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index ac55853bc7..227a9cf7fb 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -886,6 +886,8 @@ module ChefConfig
# break Chef community cookbooks and is very highly discouraged.
default :ruby_encoding, Encoding::UTF_8
+ default :rubygems_url, "https://rubygems.org"
+
# 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.
diff --git a/lib/chef/cookbook/gem_installer.rb b/lib/chef/cookbook/gem_installer.rb
index fa6dccfa4f..c0330f6c46 100644
--- a/lib/chef/cookbook/gem_installer.rb
+++ b/lib/chef/cookbook/gem_installer.rb
@@ -47,7 +47,7 @@ class Chef
unless cookbook_gems.empty?
begin
inline_gemfile do
- source "https://rubygems.org"
+ source Chef::Config[:rubygems_url]
cookbook_gems.each do |args|
gem *args
end
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index 7a2db6b32b..6b01927d50 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -535,7 +535,7 @@ class Chef
src = " --clear-sources"
src << (@new_resource.source && " --source=#{@new_resource.source}" || "")
else
- src = @new_resource.source && " --source=#{@new_resource.source} --source=https://rubygems.org"
+ src = @new_resource.source && " --source=#{@new_resource.source} --source=#{Chef::Config[:rubygems_url]}"
end
if !version.nil? && version.length > 0
shell_out_with_timeout!("#{gem_binary_path} install #{name} -q --no-rdoc --no-ri -v \"#{version}\"#{src}#{opts}", :env => nil)