Class: BitGirder::Ops::Java::JavaRunner

Inherits:
BitGirderClass
  • Object
show all
Defined in:
lib/bitgirder/ops/java.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_application_runner(opts) ⇒ Object



104
105
106
107
108
109
110
111
112
# File 'lib/bitgirder/ops/java.rb', line 104

def self.create_application_runner( opts )

    not_nil( opts, :opts )

    argv = [ has_key( opts, :main ) ]
    argv += ( opts[ :argv ] || [] )

    JavaRunner.new( opts.merge( :command => "java", :argv => argv ) )
end

.split_argv(argv) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/bitgirder/ops/java.rb', line 114

def self.split_argv( argv )
    
    res = { argv: [], sys_props: {}, jvm_args: [] }

    argv.each do |arg|
        case arg
        when /^-X/ then res[ :jvm_args ] << arg
        when /^-D(?:([^=]+)(?:=(.*))?)?$/
            raise "Property without name" unless $1
            res[ :sys_props ][ $1 ] = $2 || "" 
        else res[ :argv ] << arg
        end
    end

    res
end

Instance Method Details

#process_builderObject



94
95
96
97
98
99
100
101
102
# File 'lib/bitgirder/ops/java.rb', line 94

def process_builder

    BitGirder::Io::UnixProcessBuilder.new(
        :cmd => @java_env.jcmd( @command ),
        :argv => create_jv_argv,
        :env => @proc_env,
        :opts => @proc_opts
    )
end