Sha256: 5af922bef28c059eb73287a1e26257746d1f5c0ba9504ab717bbd405de7fb90f

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

require 'rbconfig'

module Puer
  ##
  # This method return the correct location of puer bin or
  # exec it using Kernel#system with the given args
  #
  def self.bin(*args)
    @_puer_bin ||= [self.ruby_command, File.expand_path("../../../bin/puer", __FILE__)]
    args.empty? ? @_puer_bin : system(args.unshift(@_puer_bin).join(" "))
  end

  ##
  # Return the path to the ruby interpreter taking into account multiple
  # installations and windows extensions.
  #
  def self.ruby_command
    @ruby_command ||= begin
      ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
      ruby << Config::CONFIG['EXEEXT']

      # escape string in case path to ruby executable contain spaces.
      ruby.sub!(/.*\s.*/m, '"\&"')
      ruby
    end
  end
end # Puer

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puer-0.0.6 lib/puer/command.rb