class ASDocPackage
Reads '.asdoc' files from a specified source tree and concatencates them into a xml configuration file that can be used to generate ActionScript documentation for the Actionscript packages.
Attributes
xml[R]
Public Class Methods
new(opt,out=STDOUT)
click to toggle source
Calls superclass method
Tool::new
# File lib/shed/asdoc_package.rb, line 11 def initialize(opt,out=STDOUT) super(opt,out) @asdoc = /\.asdoc$/ @header = "<?xml version='1.0' encoding='utf-8'?>\n<flex-config>\n\t<packages>\n" @package = "\t\t<package>\n\t\t\t<string>%s</string>\n\t\t\t<string><![CDATA[%s]]></string>\n\t\t</package>\n" @footer = "\t</packages>\n</flex-config>" build end
Public Instance Methods
build()
click to toggle source
Build the flex compiler config file that can be passed to the asdoc tool.
# File lib/shed/asdoc_package.rb, line 43 def build asdocs = scan(@src) if asdocs.empty? puts "No .asdoc files found." else create_xml(asdocs) to_disk(xml) end end
create_xml(asdocs)
click to toggle source
Constructs the flex complier config file when given a list of paths to asdoc files.
# File lib/shed/asdoc_package.rb, line 58 def create_xml(asdocs) @xml = @header asdocs.each { |asdoc| @xml << sprintf(@package, asdoc[:package], IO.read(asdoc[:path])) } @xml << @footer @xml end
scan(dir)
click to toggle source
Scan the given path and it's child directories for all .asdoc files.
# File lib/shed/asdoc_package.rb, line 26 def scan(dir) puts "Scanning '#{dir}' for asdoc files..." found = [] Search.find_all(@asdoc,dir,@excludes) do |path| found << {:path => path, :package => ProjectTools.package(path)} end found.each { |file| log("Adding #{file[:path]}") } found end