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



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')
  Open3.popen3('rvm get stable') do |stdin, stdout|
    output = stdout.read
    puts '  - RVM updated.'.colorize(:green) if output.include?('RVM reloaded')
  end
  break_output
end