Class: RVM

Inherits:
Object
  • Object
show all
Defined in:
lib/rvm.rb

Class Method Summary collapse

Class Method Details

.cleanupObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rvm.rb', line 16

def cleanup
  cleanup_message('RVM')
  if run?
    begin
      PTY.spawn('rvm cleanup all') do |stdin, _stdout, _stderr, _thread|
        begin
          stdin.each { |line| print line.indent(2) }
        rescue Errno::EIO
        end
      end
    rescue PTY::ChildExited
      puts 'The child process exited!'
    end
  else
    puts '  - Skipped.'.colorize(:red)
  end
  break_output
end

.installed?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/rvm.rb', line 3

def installed?
  File.exist? File.expand_path('~/.rvm')
end

.updateObject



7
8
9
10
11
12
13
14
# File 'lib/rvm.rb', line 7

def update
  check_update_message('RVM')

  result, _cmd = Open3.capture2e('rvm get stable')
  puts '  - RVM updated.'.colorize(:green) if result.include?('RVM reloaded')

  break_output
end