Sha256: 5dd0eaf255f755eb0a4afb4eb41f577830e6604e51fa98db5a59d4822329f133

Contents?: true

Size: 799 Bytes

Versions: 6

Compression:

Stored size: 799 Bytes

Contents

require 'rbconfig'

module Candle
  ##
  # This method return the correct location of candle bin or
  # exec it using Kernel#system with the given args
  #
  def self.bin(*args)
    @_candle_bin ||= [self.ruby_command, File.expand_path("../../../bin/candle", __FILE__)]
    args.empty? ? @_candle_bin : system(args.unshift(@_candle_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 # Candle

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
candle-0.0.7 lib/candle/command.rb
candle-0.0.6 lib/candle/command.rb
candle-0.0.4 lib/candle/command.rb
candle-0.0.3 lib/candle/command.rb
candle-0.0.2 lib/candle/command.rb
candle-0.0.1 lib/candle/command.rb