Class: BuildMaster::RubyAnt
- Inherits:
-
Object
- Object
- BuildMaster::RubyAnt
- Defined in:
- lib/buildmaster/ant_driver.rb
Instance Method Summary collapse
-
#initialize(ant_file = nil, &command_runner) ⇒ RubyAnt
constructor
A new instance of RubyAnt.
- #launch(arguments) ⇒ Object
Constructor Details
#initialize(ant_file = nil, &command_runner) ⇒ RubyAnt
Returns a new instance of RubyAnt.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/buildmaster/ant_driver.rb', line 74 def initialize(ant_file = nil, &command_runner) @ant_file = ant_file @ant_home = check_directory(get_environment('ANT_HOME')) @java_command = get_environment_or_default('JAVA_CMD', 'java') #ISSUE: what java wants to split up classpath varies from platform to platform #and ruby, following perl, is not too hot at hinting which box it is on. #here I assume ":" except on win32, dos, and netware. Add extra tests here as needed. #This is the only way I know how to check if on windows if File.directory?('C:') @class_path_delimiter = ';' else @class_path_delimiter = ':' end @ant_options = get_environment_or_default('ANT_OPTS').split(' ') @ant_arguments = get_environment_or_default('ANT_ARGS').split(' ') @ant_options.putsh(ENV['JIKESPATH']) if ENV['JIKESPATH'] @classpath=ENV['CLASSPATH'] @command_runner = command_runner end |
Instance Method Details
#launch(arguments) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/buildmaster/ant_driver.rb', line 94 def launch(arguments) local_path = "#{@ant_home}/lib/ant-launcher.jar" if (@classpath and @classpath.length() > 0) local_path = "#{local_path}#{@class_path_delimiter}#{@classpath}" end all_arguments = Array.new() all_arguments.push(@ant_options) all_arguments.push('-classpath', local_path) all_arguments.push("-Dant.home=#{@ant_home}") all_arguments.push('org.apache.tools.ant.launch.Launcher', @ant_arguments); all_arguments.push('-f', @ant_file) if @ant_file all_arguments.push(arguments) command_line = "#{@java_command} #{all_arguments.join(' ')}" run_command(command_line) end |