Skip to content

Commit

Permalink
(#19663) Remove --include-dependencies flag in gem package provider
Browse files Browse the repository at this point in the history
Without this patch applied the gem package provider will always pass the
`--include-dependencies` flag to the gem command.  This flag has been
deprecated in Rubygems for quite some time.  The behavior of including
dependencies when installing a gem has been the default for some time,
so this patch does not change behavior for any recent version of
Rubygems since 0.9.5.

Here is the comment from the pull request:

This is a good explanation about the option: rubygems/rubygems#385

It was already deprecated since rubygems 0.9.5 and was the default
option since then.

Unless someone is using a version of rubygems from mid 2007, this option
is never being used
https://github.com/rubygems/rubygems/blob/a00fc76fb6b959385331715c500af1eb25590405/History.txt#L1451
  • Loading branch information
juniorz authored and Jeff McCune committed Mar 8, 2013
1 parent 7e3d491 commit 2284e83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 0 additions & 2 deletions lib/puppet/provider/package/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ def self.instances(justme = false)
def install(useversion = true)
command = [command(:gemcmd), "install"]
command << "-v" << resource[:ensure] if (! resource[:ensure].is_a? Symbol) and useversion
# Always include dependencies
command << "--include-dependencies"

if source = resource[:source]
begin
Expand Down
17 changes: 6 additions & 11 deletions spec/unit/provider/package/gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,33 @@
provider.install
end

it "should specify that dependencies should be included" do
provider.expects(:execute).with { |args| args[2] == "--include-dependencies" }.returns ""
provider.install
end

it "should specify that documentation should not be included" do
provider.expects(:execute).with { |args| args[3] == "--no-rdoc" }.returns ""
provider.expects(:execute).with { |args| args[2] == "--no-rdoc" }.returns ""
provider.install
end

it "should specify that RI should not be included" do
provider.expects(:execute).with { |args| args[4] == "--no-ri" }.returns ""
provider.expects(:execute).with { |args| args[3] == "--no-ri" }.returns ""
provider.install
end

it "should specify the package name" do
provider.expects(:execute).with { |args| args[5] == "myresource" }.returns ""
provider.expects(:execute).with { |args| args[4] == "myresource" }.returns ""
provider.install
end

describe "when a source is specified" do
describe "as a normal file" do
it "should use the file name instead of the gem name" do
resource[:source] = "/my/file"
provider.expects(:execute).with { |args| args[3] == "/my/file" }.returns ""
provider.expects(:execute).with { |args| args[2] == "/my/file" }.returns ""
provider.install
end
end
describe "as a file url" do
it "should use the file name instead of the gem name" do
resource[:source] = "file:///my/file"
provider.expects(:execute).with { |args| args[3] == "/my/file" }.returns ""
provider.expects(:execute).with { |args| args[2] == "/my/file" }.returns ""
provider.install
end
end
Expand All @@ -73,7 +68,7 @@
describe "as a non-file and non-puppet url" do
it "should treat the source as a gem repository" do
resource[:source] = "http://host/my/file"
provider.expects(:execute).with { |args| args[3..5] == ["--source", "http://host/my/file", "myresource"] }.returns ""
provider.expects(:execute).with { |args| args[2..4] == ["--source", "http://host/my/file", "myresource"] }.returns ""
provider.install
end
end
Expand Down

0 comments on commit 2284e83

Please sign in to comment.