module RVM

Public Class Methods

run(ruby) click to toggle source
# File lib/cigarette/rvm.rb, line 14
def self.run(ruby)
  if block_given?
    h = {}
    h[:time]   = Time.now
    h[:ruby]   = ruby
    if @@rvm
      h[:output] = `rvm #{ruby} do #{yield} 2>&1`
    else
      h[:output] = `#{yield} 2>&1`
    end
    h[:status] = $?.success? ? "SUCCESS" : "ERROR(S)"
    h[:color]  = $?.success? ? GREEN : RED
    h
  else
    raise "You need to pass a block for RVM.run method."
  end
end
use_it!() click to toggle source
# File lib/cigarette/rvm.rb, line 6
def self.use_it!
  @@rvm = true
end
use_system!() click to toggle source
# File lib/cigarette/rvm.rb, line 10
def self.use_system!
  @@rvm = false
end