module Sprout # # The AsDoc Task provides Rake support for the asdoc documentation engine. # If a Sprout::MXMLCTask or Sprout::COMPCTask are found as prerequisites # to the AsDoc task, AsDoc will inherit the source_path and library_path # from those tasks. You can also configure AsDoc normally if you wish. # # This configuration might look something like this: # # # Create a remote library dependency on the corelib swc. # library :corelib # # # Alias the compilation task with one that is easier to type # # task :compile => 'SomeProject.swf' # # # Create an MXMLCTask named for the output file that it creates. This task depends on the # # corelib library and will automatically add the corelib.swc to it's library_path # mxmlc 'bin/SomeProject.swf' => :corelib do |t| # t.input = 'src/SomeProject.as' # t.default_size = '800 600' # t.default_background_color = "#FFFFFF" # t.source_path << 'src' # t.source_path << 'lib/asunit' # t.source_path << 'test' # end # # desc "Generate documentation" # asdoc :doc => 'bin/SomeProject.swf' # # This configuration will generate documentation in the relative path, 'doc', but only if # The contents of the documentation directory are older than the sources referenced by the compiler. # # For more information about using the asdoc command line compiler, check livedocs at: # http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=asdoc_127_1.html # class AsDocTask < ToolTask def initialize_task super @default_gem_name = 'sprout-flex2sdk-tool' @default_gem_path = 'bin/asdoc' add_param(:actionscript_file_encoding, :string) do |p| p.description = "Sets the file encoding for ActionScript files. For more information see: http://livedocs.adobe.com/flex/2/docs/00001503.html#149244" end add_param(:benchmark, :boolean) do |p| p.value = true p.show_on_false = true p.description = "Prints detailed compile times to the standard output. The default value is true." end add_param(:doc_classes, :strings) do |p| p.description =< e if(e.message.index('Warning:')) # MXMLC sends warnings to stderr.... Log.puts(e.message.gsub('[ERROR]', '[WARNING]')) else raise e end end end # The AsDoc packaage includes an asDocHelper binary that is packaged up without # the executable flag, calling Sprout::get_executable with this target will # automatically chmod it to 744. def update_helper_mode exe = Sprout.get_executable('sprout-flex2sdk-tool', 'asdoc/templates/asDocHelper', gem_version) end end end def asdoc(args, &block) Sprout::AsDocTask.define_task(args, &block) end