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.



4
5
6
7
# File 'lib/quality/ruby_spawn.rb', line 4

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

Instance Method Details

#cmd_with_ruby_hack_prefixObject



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

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



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

def invocation
  if @args.size > 0
    "#{cmd_with_ruby_hack_prefix} #{@args}"
  else
    "#{cmd_with_ruby_hack_prefix}"
  end
end