lib/packnga/yard-task.rb in packnga-0.9.1 vs lib/packnga/yard-task.rb in packnga-0.9.2
- old
+ new
@@ -25,22 +25,30 @@
# @since 0.9.0
class YARDTask
include Rake::DSL
attr_writer :readme
- # This attribute is path of base directory of document.
+
+ # @return [String] path of base directory of document.
attr_accessor :base_dir
+ # @return [Array<String>] document target files.
+ attr_accessor :files
+
+ # @return [Array<String>] custom yardoc command line options.
+ attr_accessor :options
+
# @private
def initialize(spec)
@spec = spec
@hooks = []
@readme = nil
@text_files = nil
@base_dir = nil
+ @options = []
@files = spec.files.find_all do |file|
- /\.rb\z/ =~ file
+ /\Alib\// =~ file and /\.rb\z/ =~ file
end
if block_given?
yield(self)
define
end
@@ -71,12 +79,13 @@
private
def set_default_values
@base_dir ||= "doc"
@base_dir = Pathname.new(@base_dir)
if @text_files.nil?
+ @text_files = []
text_dir = @base_dir + "text"
- @text_files = [(text_dir + "**/*").to_s] if text_dir.directory?
+ @text_files << (text_dir + "**/*").to_s if text_dir.directory?
end
end
def reference_dir
@base_dir + "reference"
@@ -99,9 +108,10 @@
yardoc_task.options += ["--files", file]
end
yardoc_task.options += ["--output-dir", reference_en_dir.to_s]
yardoc_task.options += ["--charset", "utf-8"]
yardoc_task.options += ["--no-private"]
+ yardoc_task.options += @options
yardoc_task.files += @files
@hooks.each do |hook|
hook.call(yardoc_task)
end
end