class ASRake::Asdoc

Attributes

additional_args[RW]
doc_sources[RW]

we have some special handling of this

Public Class Methods

new(output) click to toggle source
Calls superclass method
# File lib/asrake/asdoc.rb, line 118
def initialize(output)
        super

        # set all defaults
        @@compiler_args.each do |name, type|
                instance_variable_set("@#{name}", []) if type == :array || type == :dirs
        end

        @doc_sources = []
end

Public Instance Methods

add(args) click to toggle source
# File lib/asrake/asdoc.rb, line 129
def add(args)
        self.source_path << args.source_path
        self.library_path << args.library_path
        self.library_path << args.include_libraries
        self.library_path << args.external_library_path
        args.source_path.each { |p| self.doc_classes << ASRake::get_classes(p) } if args.kind_of? ASRake::Compc
end
execute(&block) click to toggle source
# File lib/asrake/asdoc.rb, line 137
def execute(&block)
        args = ""
        @@compiler_args.each do |name, type|
                arg = name.to_s.gsub('_','-')
                value = instance_variable_get("@#{name}")
                case type
                when :bool
                        args << " -#{arg}=#{value}" if value
                when :dirs
                        value.flatten!
                        value.uniq!
                        value = value.map{|s| s.index(' ') != nil ? "\"#{s}\"" : s} if value.length > 1
                        args << " -#{arg} #{Path::forward value.join(' ')}" if !value.empty?
                when :dir
                        if value != nil
                                value = "\"#{value}\"" if value.index(' ') != nil
                                args << " -#{arg}=#{Path::forward value}"
                        end
                when :array
                        value.flatten!
                        value.uniq!
                        args << " -#{arg} #{value.join(' ')}" if !value.empty?
                when :string
                        args << " -#{arg} #{value}" if value != nil
                else
                        fail "unknown type #{type}"
                end
        end
        
        # Use doc-sources argument if it has been assigned (duh) or if neither doc-classes or doc-namespaces have
        # been assigned and source-path has
        if !self.doc_sources.empty?
                args << " -doc-sources #{Path::forward doc_sources.join(' ')}"
        elsif !self.source_path.empty? && self.doc_classes.empty? && self.doc_namespaces.empty?
                args << " -doc-sources #{Path::forward source_path.join(' ')}" if !self.source_path.empty?
        end

        args << " #{additional_args}" if self.additional_args != nil
        
        run("#{FlexSDK::asdoc} #{args}", true, &block)
end

Protected Instance Methods

handle_execute_error(code) click to toggle source
# File lib/asrake/asdoc.rb, line 181
def handle_execute_error code
end
task_pre_invoke() click to toggle source
Calls superclass method
# File lib/asrake/asdoc.rb, line 184
def task_pre_invoke
        super
        # set dependencies on all .as and .mxml files in the source paths
        dependencies = FileList.new
        self.source_path.each do |path|
                dependencies.include(Path::forward File.join(path, "**/*.as"))
                dependencies.include(Path::forward File.join(path, "**/*.mxml"))
        end
        dependencies.include(self.library_path) if !self.library_path.empty?
        @task.enhance(dependencies) if !dependencies.empty?
end