Class: Buildr::AS3::Doc::Asdoc

Inherits:
Doc::Base
  • Object
show all
Defined in:
lib/buildr/as3/doc.rb

Instance Method Summary collapse

Instance Method Details

#generate(sources, target, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/buildr/as3/doc.rb', line 32

def generate(sources, target, options = {})
  dependencies = project.compile.dependencies
  sources = project.compile.sources
  flex_sdk = options[:flexsdk]
  output = (options[:output] || "#{target}")
  cmd_args = []
  cmd_args << "-classpath" << "#{flex_sdk.home}/lib/xalan.jar"
  cmd_args << "-classpath" << flex_sdk.asdoc_jar
  cmd_args << "flex2.tools.ASDoc"
  cmd_args << "+flexlib" << "#{flex_sdk.home}/frameworks"
  cmd_args << "-load-config" << flex_sdk.flex_config
  cmd_args << "-output" << output
  cmd_args << "-source-path" << sources.join(" ")
  cmd_args << "-doc-sources" << sources.join(" ")
  cmd_args << "-templates-path" << flex_sdk.asdoc_templates
  cmd_args << "-library-path+=#{dependencies.join(",")}" unless dependencies.empty?
  reserved = [:flexsdk, :main, :classpath, :sourcepath]
  options.to_hash.reject { |key, value| reserved.include?(key) }.
      each do |key, value|
    cmd_args << "-#{key}=#{value}"
  end
  flex_sdk.default_options.each do |key, value|
    cmd_args << "-#{key}=#{value}"
  end
  unless Buildr.application.options.dryrun
    Java::Commands.java cmd_args
  end
end