Add support for listing undocumented stuff.

This commit is contained in:
Nathan Weizenbaum 2010-04-19 23:25:44 -07:00
parent c974e284dd
commit 006697665d
2 changed files with 24 additions and 7 deletions

View File

@ -226,7 +226,7 @@ end
begin
require 'yard'
namespace :yard do
namespace :doc do
task :sass do
require scope('lib/sass')
Dir[scope("yard/default/**/*.sass")].each do |sass|
@ -235,12 +235,26 @@ begin
end
end
end
desc "List all undocumented methods and classes."
task :undocumented do
opts = ENV["YARD_OPTS"] || ""
ENV["YARD_OPTS"] = opts.dup + <<OPTS
--list --query "
object.docstring.blank? &&
!(object.type == :method && object.is_alias?)"
OPTS
Rake::Task['yard'].execute
end
end
YARD::Rake::YardocTask.new do |t|
t.files = FileList.new(scope('lib/**/*.rb')) do |list|
list.exclude('lib/haml/template/*.rb')
list.exclude('lib/haml/helpers/action_view_mods.rb')
list.exclude('lib/haml/helpers/xss_mods.rb')
list.exclude('lib/sass/plugin/merb.rb')
list.exclude('lib/sass/plugin/rails.rb')
end.to_a
t.options << '--incremental' if Rake.application.top_level_tasks.include?('redoc')
t.options += FileList.new(scope('yard/*.rb')).to_a.map {|f| ['-e', f]}.flatten
@ -248,12 +262,15 @@ begin
t.options << '--files' << files.join(',')
t.options << '--template-path' << scope('yard')
t.options << '--title' << ENV["YARD_TITLE"] if ENV["YARD_TITLE"]
if ENV["YARD_OPTS"]
require 'shellwords'
t.options.concat(Shellwords.shellwords(ENV["YARD_OPTS"]))
t.before = lambda do
if ENV["YARD_OPTS"]
require 'shellwords'
t.options.concat(Shellwords.shellwords(ENV["YARD_OPTS"]))
end
end
end
Rake::Task['yard'].prerequisites.insert(0, 'yard:sass')
Rake::Task['yard'].prerequisites.insert(0, 'doc:sass')
Rake::Task['yard'].instance_variable_set('@comment', nil)
desc "Generate Documentation"

View File

@ -106,7 +106,7 @@ module Sass::Script
# @raise [NoMethodError] if `other` is an invalid type
def times(other)
if other.is_a? Number
self.operate(other, :*)
operate(other, :*)
elsif other.is_a? Color
other.times(self)
else
@ -284,7 +284,7 @@ module Sass::Script
end, num_units, den_units)
end
protected
private
def operate(other, operation)
this = self