Module: RVM

Includes:
Colors
Defined in:
lib/cigarette/rvm.rb

Constant Summary collapse

@@rvm =
true

Constants included from Colors

Colors::BLACK, Colors::BLUE, Colors::CYAN, Colors::DEFAULT, Colors::GREEN, Colors::MAGENTA, Colors::RED, Colors::WHITE, Colors::YELLOW

Class Method Summary collapse

Class Method Details

.run(ruby) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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!Object



6
7
8
# File 'lib/cigarette/rvm.rb', line 6

def self.use_it!
  @@rvm = true
end

.use_system!Object



10
11
12
# File 'lib/cigarette/rvm.rb', line 10

def self.use_system!
  @@rvm = false
end