Class: Airake::Commands::Acompc

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

Overview

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 = {}) ⇒ Acompc

Create ACOMPC command.

Options

acompc_path

Path to acompc, defaults to ‘acompc’

source_path

Path to source, defaults to ‘src’

output_path

Path to output (required)

include_packages

Array of package names to include (required). Example, com.airake.utils will include all classes from Dir[“com/airake/utils/*/.as”]

acompc_extra_opts

Extra options for command line



21
22
23
24
25
# File 'lib/airake/commands/acompc.rb', line 21

def initialize(options = {})
  assert_required(options, [ :output_path, :include_packages ])
  with_options(options, { :acompc_path => "acompc", :source_path => "src" })                        
  @include_classes = include_classes(@source_path, @include_packages)
end

Instance Attribute Details

#acompc_extra_optsObject (readonly)

Returns the value of attribute acompc_extra_opts.



10
11
12
# File 'lib/airake/commands/acompc.rb', line 10

def acompc_extra_opts
  @acompc_extra_opts
end

#acompc_pathObject (readonly)

Returns the value of attribute acompc_path.



10
11
12
# File 'lib/airake/commands/acompc.rb', line 10

def acompc_path
  @acompc_path
end

#include_packagesObject (readonly)

Returns the value of attribute include_packages.



10
11
12
# File 'lib/airake/commands/acompc.rb', line 10

def include_packages
  @include_packages
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



10
11
12
# File 'lib/airake/commands/acompc.rb', line 10

def output_path
  @output_path
end

#source_pathObject (readonly)

Returns the value of attribute source_path.



10
11
12
# File 'lib/airake/commands/acompc.rb', line 10

def source_path
  @source_path
end

Instance Method Details

#compileObject

Get the acompc compile command



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/airake/commands/acompc.rb', line 28

def compile
  command = []
  command << @acompc_path
  command << @acompc_extra_opts
  command << "-source-path"
  command << @source_path
  command << "-include-classes"
  command << @include_classes.join(" ")
  command << "-output"
  command << @output_path        
  process(command)
end