@@ -39,8 +39,7 @@ def initialize(droplet_root)
3939 # @param [Pathname] path the path to the +javaagent+ JAR
4040 # @return [JavaOpts] +self+ for chaining
4141 def add_javaagent ( path )
42- self << "-javaagent:#{ qualify_path path } "
43- self
42+ add_preformatted_options "-javaagent:#{ qualify_path path } "
4443 end
4544
4645 # Adds an +agentpath+ entry to the +JAVA_OPTS+. Prepends +$PWD+ to the path (relative to the droplet root) to
@@ -49,8 +48,7 @@ def add_javaagent(path)
4948 # @param [Pathname] path the path to the +native+ +agent+
5049 # @return [JavaOpts] +self+ for chaining
5150 def add_agentpath ( path )
52- self << "-agentpath:#{ qualify_path path } "
53- self
51+ add_preformatted_options "-agentpath:#{ qualify_path path } "
5452 end
5553
5654 # Adds a +bootclasspath/p+ entry to the +JAVA_OPTS+. Prepends +$PWD+ to the path (relative to the droplet root) to
@@ -59,8 +57,7 @@ def add_agentpath(path)
5957 # @param [Pathname] path the path to the +javaagent+ JAR
6058 # @return [JavaOpts] +self+ for chaining
6159 def add_bootclasspath_p ( path )
62- self << "-Xbootclasspath/p:#{ qualify_path path } "
63- self
60+ add_preformatted_options "-Xbootclasspath/p:#{ qualify_path path } "
6461 end
6562
6663 # Adds a system property to the +JAVA_OPTS+. Ensures that the key is prepended with +-D+. If the value is a
@@ -71,19 +68,26 @@ def add_bootclasspath_p(path)
7168 # @param [Pathname, String] value the value of the system property
7269 # @return [JavaOpts] +self+ for chaining
7370 def add_system_property ( key , value )
74- self << "-D#{ key } =#{ qualify_value ( value ) } "
75- self
71+ add_preformatted_options "-D#{ key } =#{ qualify_value ( value ) } "
7672 end
7773
7874 # Adds an option to the +JAVA_OPTS+. Nothing is prepended to the key. If the value is a +Pathname+, then
7975 # prepends +$PWD+ to the path (relative to the droplet root) to ensure that the path is always accurate.
8076 # Otherwise, uses the value as-is.
8177 #
8278 # @param [String] key the key of the option
83- # @param [Pathname, String] value the value of the system property
79+ # @param [Pathname, String] value the value of the option
8480 # @return [JavaOpts] +self+ for chaining
8581 def add_option ( key , value )
86- self << "#{ key } =#{ qualify_value ( value ) } "
82+ add_preformatted_options "#{ key } =#{ qualify_value ( value ) } "
83+ end
84+
85+ # Adds a preformatted option to the +JAVA_OPTS+
86+ #
87+ # @param [String] value the value of options
88+ # @return [JavaOpts] +self+ for chaining
89+ def add_preformatted_options ( value )
90+ self << value
8791 self
8892 end
8993
0 commit comments