Class: Airake::Commands::Asdoc

Inherits:
Base show all
Defined in:
lib/airake/commands/asdoc.rb

Overview

ASDOC

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#assert_not_blank, #assert_required, #escape, #include_classes, #library_paths, #process, #relative_path, #source_paths, #windows?, #with_options

Constructor Details

#initialize(options = {}) ⇒ Asdoc

Create ASDOC command.

Options

asdoc_path

Path to asdoc, defaults to ‘asdoc’

src_dirs

Paths to source (array), defaults to [ ‘src’ ]

lib_dir

Path to lib directory.

output_dir

Path to output directory, defaults to “doc/asdoc”

asdoc_extra_opts

Extra options for command line

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/airake/commands/asdoc.rb', line 19

def initialize(options = {})
  with_options(options, { :asdoc_path => "asdoc", :output_dir => "doc/asdoc" })               
  
  @source_paths = source_paths(@src_dirs, @lib_dir)
  raise ArgumentError, "There aren't any valid source directories to compile" if @source_paths.empty?
  
  @library_paths = []
  if @lib_dir and File.directory?(@lib_dir)
    @library_paths << escape(@lib_dir) 
  end
  @library_paths << "#{frameworks_dir}/libs"
  @library_paths << "#{frameworks_dir}/libs/air"
  @library_paths << "#{frameworks_dir}/locale/en_US"
end

Instance Attribute Details

#asdoc_extra_optsObject (readonly)

Returns the value of attribute asdoc_extra_opts.



8
9
10
# File 'lib/airake/commands/asdoc.rb', line 8

def asdoc_extra_opts
  @asdoc_extra_opts
end

#asdoc_pathObject (readonly)

Returns the value of attribute asdoc_path.



8
9
10
# File 'lib/airake/commands/asdoc.rb', line 8

def asdoc_path
  @asdoc_path
end

#lib_dirObject (readonly)

Returns the value of attribute lib_dir.



8
9
10
# File 'lib/airake/commands/asdoc.rb', line 8

def lib_dir
  @lib_dir
end

#output_dirObject (readonly)

Returns the value of attribute output_dir.



8
9
10
# File 'lib/airake/commands/asdoc.rb', line 8

def output_dir
  @output_dir
end

#src_dirsObject (readonly)

Returns the value of attribute src_dirs.



8
9
10
# File 'lib/airake/commands/asdoc.rb', line 8

def src_dirs
  @src_dirs
end

Instance Method Details

#frameworks_dirObject

This only works on bash



35
36
37
# File 'lib/airake/commands/asdoc.rb', line 35

def frameworks_dir
  "$(dirname `which asdoc`)/../frameworks"
end

#generateObject

Get the amxmlc compile command



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/airake/commands/asdoc.rb', line 40

def generate
  command = []
  command << @asdoc_path
  command << @asdoc_extra_opts
  command << "-source-path #{@source_paths.join(" ")}"
  
  @library_paths.each do |library_path|
    command << "-library-path #{library_path}"
  end
  command << "-doc-sources #{@source_paths.join(" ")}"
  command << "-output #{@output_dir}"              
  process(command)
end