Skip to content

Commit

Permalink
Complain when description and summary are identical
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/rubygems/trunk@2166 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information
drbrain committed Apr 14, 2009
1 parent e23421b commit cedceb2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,5 +1,10 @@
# -*- coding: utf-8 -*-

2009-04-14 Eric Hodel <drbrain@segment7.net>

* lib/rubygems/specification.rb: Complain when summary and
description are identical.

2009-04-08 Eric Hodel <drbrain@segment7.net>

* lib/rubygems/specification.rb: Strip directories, complain for
Expand Down
2 changes: 1 addition & 1 deletion doc/release_notes/rel_1_3_2.rdoc
Expand Up @@ -25,7 +25,7 @@ Select New Features:
* #validate strips directories and errors on not-files.
* #description no longer removes newlines.
* #name must be a String.
* FIXME is no longer allowed in various fields.
* FIXME and TODO are no longer allowed in various fields.
* Added support for a license attribute. Feature #11041 (partial).
* Removed Gem::Specification::list, too much process growth. Bug #23668 by
Steve Purcell.
Expand Down
6 changes: 5 additions & 1 deletion lib/rubygems/specification.rb
Expand Up @@ -890,11 +890,15 @@ def validate

# Warnings

%w[author email homepage rubyforge_project summary].each do |attribute|
%w[author description email homepage rubyforge_project summary].each do |attribute|
value = self.send attribute
alert_warning "no #{attribute} specified" if value.nil? or value.empty?
end

if summary and not summary.empty? and description == summary then
alert_warning 'description and summary are identical'
end

alert_warning "RDoc will not be generated (has_rdoc == false)" unless
has_rdoc

Expand Down
19 changes: 19 additions & 0 deletions test/test_gem_specification.rb
Expand Up @@ -952,6 +952,25 @@ def test_validate_description
util_setup_validate

Dir.chdir @tempdir do
@a1.description = ''

use_ui @ui do
@a1.validate
end

assert_equal "WARNING: no description specified\n", @ui.error, 'error'

@ui = MockGemUi.new
@a1.summary = 'this is my summary'
@a1.description = @a1.summary

use_ui @ui do
@a1.validate
end

assert_equal "WARNING: description and summary are identical\n",
@ui.error, 'error'

@a1.description = 'FIXME (describe your package)'

e = assert_raises Gem::InvalidSpecificationException do
Expand Down

0 comments on commit cedceb2

Please sign in to comment.