diff options
author | Pete Higgins <pete@peterhiggins.org> | 2020-03-16 17:19:00 -0700 |
---|---|---|
committer | Pete Higgins <pete@peterhiggins.org> | 2020-03-23 13:55:01 -0700 |
commit | 292be14eaaba828f74214ddcff9348f0a164aaae (patch) | |
tree | 6ac9238627eb4b2e36c914a62a478f1012f3294b | |
parent | 8cf05f924432584b28df52cf961e19bef9cb8960 (diff) | |
download | chef-292be14eaaba828f74214ddcff9348f0a164aaae.tar.gz |
Switch to canonical "https://rubygems.org" URL for rubygems.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r-- | lib/chef/cookbook/gem_installer.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/package/rubygems.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/gem_package.rb | 2 | ||||
-rw-r--r-- | spec/unit/cookbook/gem_installer_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/package/rubygems_spec.rb | 38 |
5 files changed, 24 insertions, 24 deletions
diff --git a/lib/chef/cookbook/gem_installer.rb b/lib/chef/cookbook/gem_installer.rb index cf0177d1d5..172c1e6448 100644 --- a/lib/chef/cookbook/gem_installer.rb +++ b/lib/chef/cookbook/gem_installer.rb @@ -57,7 +57,7 @@ class Chef begin Dir.mktmpdir("chef-gem-bundle") do |dir| File.open("#{dir}/Gemfile", "w+") do |tf| - Array(Chef::Config[:rubygems_url] || "https://www.rubygems.org").each do |s| + Array(Chef::Config[:rubygems_url] || "https://rubygems.org").each do |s| tf.puts "source '#{s}'" end cookbook_gems.each do |gem_name, args| diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 8b67006336..a8d8fefb15 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -485,7 +485,7 @@ class Chef def gem_sources srcs = [ new_resource.source ] - srcs << (Chef::Config[:rubygems_url] || "https://www.rubygems.org") if new_resource.include_default_source + srcs << (Chef::Config[:rubygems_url] || "https://rubygems.org") if new_resource.include_default_source srcs.flatten.compact end diff --git a/lib/chef/resource/gem_package.rb b/lib/chef/resource/gem_package.rb index 80eb257fa1..cfa2d89fad 100644 --- a/lib/chef/resource/gem_package.rb +++ b/lib/chef/resource/gem_package.rb @@ -30,7 +30,7 @@ class Chef # the source can either be a path to a package source like: # source /var/tmp/mygem-1.2.3.4.gem # or it can be a url rubygems source like: - # https://www.rubygems.org + # https://rubygems.org # the default has to be nil in order for the magical wiring up of the name property to # the source pathname to work correctly. # diff --git a/spec/unit/cookbook/gem_installer_spec.rb b/spec/unit/cookbook/gem_installer_spec.rb index 5cb995e33b..2733dfc862 100644 --- a/spec/unit/cookbook/gem_installer_spec.rb +++ b/spec/unit/cookbook/gem_installer_spec.rb @@ -78,7 +78,7 @@ describe Chef::Cookbook::GemInstaller do it "generates a valid Gemfile when Chef::Config[:rubygems_url] is set to a String" do expect(gem_installer).to receive(:shell_out!).and_return(shell_out) - Chef::Config[:rubygems_url] = "https://www.rubygems.org" + Chef::Config[:rubygems_url] = "https://rubygems.org" expect { gem_installer.install }.to_not raise_error expect(bundler_dsl.dependencies.find { |d| d.name == "httpclient" }.requirements_list.length).to eql(2) @@ -86,7 +86,7 @@ describe Chef::Cookbook::GemInstaller do it "generates a valid Gemfile when Chef::Config[:rubygems_url] is set to an Array" do expect(gem_installer).to receive(:shell_out!).and_return(shell_out) - Chef::Config[:rubygems_url] = [ "https://www.rubygems.org" ] + Chef::Config[:rubygems_url] = [ "https://rubygems.org" ] expect { gem_installer.install }.to_not raise_error diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index 2d3f0771c0..63fc0231cd 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -585,7 +585,7 @@ describe Chef::Provider::Package::Rubygems do it "determines the candidate version by querying the remote gem servers" do expect(provider.gem_env).to receive(:candidate_version_from_remote) - .with(gem_dep, source, "https://www.rubygems.org") + .with(gem_dep, source, "https://rubygems.org") .and_return(Gem::Version.new(target_version)) expect(provider.candidate_version).to eq(target_version) end @@ -605,7 +605,7 @@ describe Chef::Provider::Package::Rubygems do it "determines the candidate version by querying the remote gem servers" do expect(provider.gem_env).to receive(:candidate_version_from_remote) - .with(gem_dep, *[source, "https://www.rubygems.org" ].flatten) + .with(gem_dep, *[source, "https://rubygems.org" ].flatten) .and_return(Gem::Version.new(target_version)) expect(provider.candidate_version).to eq(target_version) end @@ -645,13 +645,13 @@ describe Chef::Provider::Package::Rubygems do before do expected_source = [ source ] - expected_source << "https://www.rubygems.org" if include_default_source + expected_source << "https://rubygems.org" if include_default_source allow(provider.gem_env).to receive(:candidate_version_from_remote).with(gem_dep, *expected_source.flatten.compact).and_return(version) end describe "in the current gem environment" do it "installs the gem via the gems api when no explicit options are used" do - expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [ "https://www.rubygems.org" ]) + expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [ "https://rubygems.org" ]) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end @@ -660,7 +660,7 @@ describe Chef::Provider::Package::Rubygems do let(:source) { "http://gems.example.org" } it "installs the gem via the gems api" do - expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [source, "https://www.rubygems.org"]) + expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [source, "https://rubygems.org"]) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end @@ -691,7 +691,7 @@ describe Chef::Provider::Package::Rubygems do it "installs the gem via the gems api, when the package has no file separator characters in it, but a matching file exists in cwd" do allow(::File).to receive(:exist?).and_return(true) new_resource.package_name("rspec-core") - expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [ "https://www.rubygems.org" ]) + expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [ "https://rubygems.org" ]) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end @@ -700,14 +700,14 @@ describe Chef::Provider::Package::Rubygems do let(:options) { "-i /alt/install/location" } it "installs the gem by shelling out when options are provided as a String" do - expected = "gem install rspec-core -q --no-document -v \"#{target_version}\" --source=https://www.rubygems.org #{options}" + expected = "gem install rspec-core -q --no-document -v \"#{target_version}\" --source=https://rubygems.org #{options}" expect(provider).to receive(:shell_out_compacted!).with(expected, env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end it "unmockening needs_nodocument?" do - expected = "gem install rspec-core -q --no-document -v \"#{target_version}\" --source=https://www.rubygems.org #{options}" + expected = "gem install rspec-core -q --no-document -v \"#{target_version}\" --source=https://rubygems.org #{options}" expect(provider).to receive(:needs_nodocument?).and_call_original stub_const("Gem::VERSION", "3.0.0") expect(provider).to receive(:shell_out_compacted!).with(expected, env: nil, timeout: 900) @@ -716,7 +716,7 @@ describe Chef::Provider::Package::Rubygems do end it "when the rubygems_version is old it uses the old flags" do - expected = "gem install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" --source=https://www.rubygems.org #{options}" + expected = "gem install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" --source=https://rubygems.org #{options}" expect(provider).to receive(:needs_nodocument?).and_call_original stub_const("Gem::VERSION", "2.8.0") expect(provider).to receive(:shell_out_compacted!).with(expected, env: nil, timeout: 900) @@ -743,7 +743,7 @@ describe Chef::Provider::Package::Rubygems do let(:gem_binary) { "/foo/bar" } it "installs the gem with rubygems.org as an added source" do - expected = "#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --clear-sources --source=#{source} --source=https://www.rubygems.org" + expected = "#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --clear-sources --source=#{source} --source=https://rubygems.org" expect(provider).to receive(:shell_out_compacted!).with(expected, env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action @@ -767,7 +767,7 @@ describe Chef::Provider::Package::Rubygems do let(:gem_binary) { "/foo/bar" } it "installs the gem with an array as an added source" do - expected = "#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --clear-sources --source=https://mirror1 --source=https://mirror2 --source=https://www.rubygems.org" + expected = "#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --clear-sources --source=https://mirror1 --source=https://mirror2 --source=https://rubygems.org" expect(provider).to receive(:shell_out_compacted!).with(expected, env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action @@ -792,7 +792,7 @@ describe Chef::Provider::Package::Rubygems do it "installs the gem" do new_resource.clear_sources(true) - expected = "#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --clear-sources --source=#{source} --source=https://www.rubygems.org" + expected = "#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --clear-sources --source=#{source} --source=https://rubygems.org" expect(provider).to receive(:shell_out_compacted!).with(expected, env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action @@ -805,7 +805,7 @@ describe Chef::Provider::Package::Rubygems do it "installs the gem" do new_resource.clear_sources(false) - expected = "#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --source=#{source} --source=https://www.rubygems.org" + expected = "#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --source=#{source} --source=https://rubygems.org" expect(provider).to receive(:shell_out_compacted!).with(expected, env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action @@ -817,7 +817,7 @@ describe Chef::Provider::Package::Rubygems do let(:options) { "-i /alt/install/location" } it "installs the gem by shelling out when options are provided but no version is given" do - expected = "gem install rspec-core -q --no-document -v \"#{candidate_version}\" --source=https://www.rubygems.org #{options}" + expected = "gem install rspec-core -q --no-document -v \"#{candidate_version}\" --source=https://rubygems.org #{options}" expect(provider).to receive(:shell_out_compacted!).with(expected, env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action @@ -828,7 +828,7 @@ describe Chef::Provider::Package::Rubygems do let(:options) { { install_dir: "/alt/install/location" } } it "installs the gem via the gems api when options are given as a Hash" do - expect(provider.gem_env).to receive(:install).with(gem_dep, { sources: [ "https://www.rubygems.org" ] }.merge(options)) + expect(provider.gem_env).to receive(:install).with(gem_dep, { sources: [ "https://rubygems.org" ] }.merge(options)) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end @@ -838,7 +838,7 @@ describe Chef::Provider::Package::Rubygems do let(:target_version) { "9000.0.2" } it "installs the gem via the gems api" do - expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [ "https://www.rubygems.org" ] ) + expect(provider.gem_env).to receive(:install).with(gem_dep, sources: [ "https://rubygems.org" ] ) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end @@ -881,7 +881,7 @@ describe Chef::Provider::Package::Rubygems do let(:gem_binary) { "/usr/weird/bin/gem" } it "installs the gem by shelling out to gem install" do - expect(provider).to receive(:shell_out_compacted!).with("#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --source=https://www.rubygems.org", env: nil, timeout: 900) + expect(provider).to receive(:shell_out_compacted!).with("#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --source=https://rubygems.org", env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end @@ -889,7 +889,7 @@ describe Chef::Provider::Package::Rubygems do it "unmockening needs_nodocument?" do expect(provider).to receive(:needs_nodocument?).and_call_original expect(provider.gem_env).to receive(:shell_out!).with("#{gem_binary} --version").and_return(instance_double(Mixlib::ShellOut, stdout: "3.0.0\n")) - expect(provider).to receive(:shell_out_compacted!).with("#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --source=https://www.rubygems.org", env: nil, timeout: 900) + expect(provider).to receive(:shell_out_compacted!).with("#{gem_binary} install rspec-core -q --no-document -v \"#{target_version}\" --source=https://rubygems.org", env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end @@ -897,7 +897,7 @@ describe Chef::Provider::Package::Rubygems do it "when the rubygems_version is old it uses the old flags" do expect(provider).to receive(:needs_nodocument?).and_call_original expect(provider.gem_env).to receive(:shell_out!).with("#{gem_binary} --version").and_return(instance_double(Mixlib::ShellOut, stdout: "2.8.0\n")) - expect(provider).to receive(:shell_out_compacted!).with("#{gem_binary} install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" --source=https://www.rubygems.org", env: nil, timeout: 900) + expect(provider).to receive(:shell_out_compacted!).with("#{gem_binary} install rspec-core -q --no-rdoc --no-ri -v \"#{target_version}\" --source=https://rubygems.org", env: nil, timeout: 900) provider.run_action(:install) expect(new_resource).to be_updated_by_last_action end |