Top Level Namespace
Defined Under Namespace
Modules: JavaTools
Instance Method Summary collapse
-
#jar(output, files = nil, options = nil) ⇒ Object
Jar can be run in either command or yield mode: command mode looks roughly like this:.
-
#javac(source_files, options = nil) ⇒ Object
Javac can be run in either command or yield mode: command mode looks roughly like this:.
Instance Method Details
#jar(output, files = nil, options = nil) ⇒ Object
Jar can be run in either command or yield mode: command mode looks roughly like this:
jar 'output.jar', [file1, file2], :base_dir => 'build'
and yield mode like this:
jar('output.jar', [file1, file2]) do |conf|
conf.base_dir = 'build'
end
In command mode you pass a hash with the configuration directives (listed below) and in yield mode an object is passed to the block, and the configuration directives should be set on that.
The possible configuration directives are:
-
base_dir
-
compression
-
verbose
The directives are the same as the properties of JavaTools::Javac.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/java_tools.rb', line 90 def jar( output, files = nil, = nil ) base_dir = nil if && [:base_dir] base_dir = [:base_dir] end obj = JavaTools::Jar.new(output, files, base_dir) if block_given? yield obj elsif JavaTools::configure_command(obj, ) end obj.execute end |
#javac(source_files, options = nil) ⇒ Object
Javac can be run in either command or yield mode: command mode looks roughly like this:
javac [file1, file2], :destination => 'build'
and yield mode like this:
javac(file1, file2) do |conf|
conf.destination = 'build'
end
In command mode you pass a hash with the configuration directives (listed below) and in yield mode an object is passed to the block, and the configuration directives should be set on that.
The possible configuration directives are:
-
source_path
-
destination
-
class_path
-
deprecation_warnings
-
warnings
-
encoding
-
verbose
The directives are the same as the properties of JavaTools::Javac.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/java_tools.rb', line 57 def javac( source_files, = nil ) obj = JavaTools::Javac.new(*source_files) if block_given? yield obj elsif JavaTools::configure_command(obj, ) end obj.execute end |