class Buildr::Doc::DocTask

Attributes

classpath[RW]

Classpath dependencies.

options[R]

Returns the documentation tool options.

sourcepath[RW]

Additional sourcepaths that are not part of the documented files.

target[R]

The target directory for the generated documentation files.

Public Instance Methods

engine() click to toggle source
# File lib/buildr/core/doc.rb, line 162
def engine
  @engine ||= guess_engine
end
engine?(clazz) → boolean click to toggle source

Check if the underlying engine is an instance of the given class

# File lib/buildr/core/doc.rb, line 170
def engine?(clazz)
  begin
    @engine ||= guess_engine if project.compile.language
  rescue
    return false
  end
  @engine.is_a?(clazz) if @engine
end
exclude(*files) → self click to toggle source

Excludes source files and directories from generating the documentation.

# File lib/buildr/core/doc.rb, line 129
def exclude(*files)
  @files.exclude *files.collect{|f|File.expand_path(f)}
  self
end
from(*sources) → self click to toggle source

Includes files, directories and projects in the documentation and returns self.

You can call this method with source files and directories containing source files to include these files in the documentation, similar to include. You can also call this method with projects. When called with a project, it includes all the source files compiled by that project and classpath dependencies used when compiling.

For example:

doc.from projects('myapp:foo', 'myapp:bar')
# File lib/buildr/core/doc.rb, line 191
def from(*sources)
  sources.flatten.each do |source|
    case source
    when Project
      self.enhance source.prerequisites
      self.include source.compile.sources
      self.with source.compile.dependencies
    when Rake::Task, String
      self.include source
    else
      fail "Don't know how to generate documentation from #{source || 'nil'}"
    end
  end
  self
end
include(*files) → self click to toggle source

Includes additional source files and directories when generating the documentation and returns self. When specifying a directory, includes all source files in that directory.

# File lib/buildr/core/doc.rb, line 114
def include(*files)
  files.each do |file|
    if file.respond_to? :to_ary
      include(*file.to_ary)
    else
      @files.include *files.flatten.compact.collect { |f| File.expand_path(f.to_s) }
    end
  end
  self
end
into(path) → self click to toggle source

Sets the target directory and returns self. This will also set the Javadoc task as a prerequisite to a file task on the target directory.

For example:

package :zip, :classifier=>'docs', :include=>doc.target
# File lib/buildr/core/doc.rb, line 104
def into(path)
  @target = file(path.to_s).enhance([self]) unless @target && @target.to_s == path.to_s
  self
end
using(options) → self click to toggle source

Sets the documentation tool options from a hash and returns self.

For example:

doc.using :windowtitle=>'My application'
doc.using :vscaladoc
# File lib/buildr/core/doc.rb, line 151
def using(*args)
  args.pop.each { |key, value| @options[key.to_sym] = value } if Hash === args.last

  until args.empty?
    new_engine = Doc.select_by_name(args.pop)
    @engine = new_engine.new(project) unless new_engine.nil?
  end

  self
end
with(*artifacts) → self click to toggle source

Adds files and artifacts as classpath dependencies, and returns self.

# File lib/buildr/core/doc.rb, line 138
def with(*specs)
  @classpath |= Buildr.artifacts(specs.flatten).uniq
  self
end