Module: Juicer::Minifyer::JavaBase

Includes:
Binary
Included in:
ClosureCompiler, YuiCompressor
Defined in:
lib/juicer/minifyer/java_base.rb

Overview

Provides an interface to Java based compressor libraries using Juicer::Shell::Binary.

The compressor is invoked using the java binary and the compressor jar file.

Providing the Jar file can be done in several ways. The following directories are searched (in preferred order)

1. The directory specified by the option :bin_path
2. The directory specified by the environment variable, if set
3. Current working directory

Name of environment variable is decided by including classes self.env_name constant.

For more information on how the Jar is located, see Juicer::Minify::JavaMinifyer.locate_jar

Author

Christian Johansen ([email protected])

Copyright

Copyright © 2008-2009 Christian Johansen

License

MIT

Instance Method Summary collapse

Methods included from Binary

#command, #execute, #get_opt, #locate, #method_missing, #options, #path, #set_opt

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Juicer::Binary

Instance Method Details

#initialize(options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/juicer/minifyer/java_base.rb', line 34

def initialize(options = {})
  bin = options.delete(:java) || "java"
  bin_path = options.delete(:bin_path) || nil
  @jar = nil
  @jar_args = nil

  super(bin, options)
  path << bin_path if bin_path
end

#jar_argsObject



51
52
53
# File 'lib/juicer/minifyer/java_base.rb', line 51

def jar_args
  @jar_args
end

#set_opts(args) ⇒ Object

Overrides set_opts called from binary class This avoids sending illegal options to the java binary



47
48
49
# File 'lib/juicer/minifyer/java_base.rb', line 47

def set_opts(args)
  @jar_args = " #{args}"
end