Class: Quality::RubySpawn

Inherits:
Object
  • Object
show all
Defined in:
lib/quality/ruby_spawn.rb

Overview

Spawn a ruby process

Instance Method Summary collapse

Constructor Details

#initialize(cmd, args) ⇒ RubySpawn

Returns a new instance of RubySpawn.



6
7
8
9
# File 'lib/quality/ruby_spawn.rb', line 6

def initialize(cmd, args)
  @cmd = cmd
  @args = args
end

Instance Method Details

#cmd_with_ruby_hack_prefixObject



19
20
21
22
23
24
25
26
27
# File 'lib/quality/ruby_spawn.rb', line 19

def cmd_with_ruby_hack_prefix
  if defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'jruby')
    "jruby -S #{@cmd}"
  elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
    "#{@cmd}.bat"
  else
    @cmd
  end
end

#invocationObject



11
12
13
14
15
16
17
# File 'lib/quality/ruby_spawn.rb', line 11

def invocation
  if !@args.empty?
    "#{cmd_with_ruby_hack_prefix} #{@args}"
  else
    cmd_with_ruby_hack_prefix.to_s
  end
end