def validate
extend Gem::UserInteraction
normalize
if rubygems_version != RubyGemsVersion then
raise Gem::InvalidSpecificationException,
"expected RubyGems version #{RubyGemsVersion}, was #{rubygems_version}"
end
@@required_attributes.each do |symbol|
unless self.send symbol then
raise Gem::InvalidSpecificationException,
"missing value for attribute #{symbol}"
end
end
if require_paths.empty? then
raise Gem::InvalidSpecificationException,
"specification must have at least one require_path"
end
case platform
when Gem::Platform, Platform::RUBY then
else
raise Gem::InvalidSpecificationException,
"invalid platform #{platform.inspect}, see Gem::Platform"
end
unless Array === authors and
authors.all? { |author| String === author } then
raise Gem::InvalidSpecificationException,
'authors must be Array of Strings'
end
%w[author email homepage rubyforge_project summary].each do |attribute|
value = self.send attribute
alert_warning "no #{attribute} specified" if value.nil? or value.empty?
end
alert_warning "RDoc will not be generated (has_rdoc == false)" unless
has_rdoc
alert_warning "deprecated autorequire specified" if autorequire
executables.each do |executable|
executable_path = File.join bindir, executable
shebang = File.read(executable_path, 2) == '#!'
alert_warning "#{executable_path} is missing #! line" unless shebang
end
true
end