Skip to content

Commit

Permalink
make ruby_exe resolution lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Feb 12, 2015
1 parent 35340f1 commit 0e2073b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/systemu.rb
Expand Up @@ -29,16 +29,20 @@ def SystemUniversal.description
@pid = Process.pid
@turd = ENV['SYSTEMU_TURD']

c = begin; ::RbConfig::CONFIG; rescue NameError; ::Config::CONFIG; end
ruby = File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']
@ruby = if system('%s -e 42' % ruby)
ruby
else
system('%s -e 42' % 'ruby') ? 'ruby' : warn('no ruby in PATH/CONFIG')
def self.ruby
return @ruby if @ruby

c = begin; ::RbConfig::CONFIG; rescue NameError; ::Config::CONFIG; end
ruby = File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']
@ruby = if system('%s -e 42' % ruby)
ruby
else
system('%s -e 42' % 'ruby') ? 'ruby' : warn('no ruby in PATH/CONFIG')
end
end

class << SystemUniversal
%w( host ppid pid ruby turd ).each{|a| attr_accessor a}
%w( host ppid pid turd ).each{|a| attr_accessor a}

def quote(*words)
words.map{|word| word.inspect}.join(' ')
Expand Down

0 comments on commit 0e2073b

Please sign in to comment.