Skip to content

Commit

Permalink
Gem development requirements will no longer be used as rpm requirements.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/gem2rpm/trunk@31 d96f4f69-a08a-4656-9eac-efc2c5ef80a5
  • Loading branch information
lutter committed Jul 19, 2010
1 parent 125de44 commit 10e8f80
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/gem2rpm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ def Gem2Rpm.packager()
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: rubygems
<% for d in spec.dependencies %>
<% if (!d.respond_to?(:type)) or (d.respond_to?(:type) and d.type == :runtime) %>
<% for req in d.version_requirements.to_rpm %>
Requires: rubygem(<%= d.name %>) <%= req %>
<% end %>
<% end %>
<% end %>
BuildRequires: rubygems
<% if spec.extensions.empty? %>
BuildArch: noarch
Expand Down
Binary file added test/artifacts/test-1.0.0.gem
Binary file not shown.
12 changes: 12 additions & 0 deletions test/test_gem2rpm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@ def test_pessimistic_version_constraint_with_trailing_text
end
end

def test_omitting_development_requirements_from_spec
# Only run this test if rubygems 1.2.0 or later.
if Gem::Version.create(Gem::RubyGemsVersion) >= Gem::Version.create("1.2.0")
out = StringIO.new

gem_path = File.join(File.dirname(__FILE__), "artifacts", "test-1.0.0.gem")
Gem2Rpm::convert(gem_path, Gem2Rpm::TEMPLATE, out, false)

assert_no_match(/\sRequires: rubygem\(test_development\)/, out.string)
end
end

end

0 comments on commit 10e8f80

Please sign in to comment.