class Getch::Emerge

Use system, the only ruby method to display stdout with colors !

Public Class Methods

new(cmd) click to toggle source
# File lib/getch/command.rb, line 74
def initialize(cmd)
  @gentoo = MOUNTPOINT
  @cmd = cmd
  @log = Getch::Log.new
end

Public Instance Methods

pkg!() click to toggle source
# File lib/getch/command.rb, line 86
def pkg!
  @log.info "Running emerge pkg: #{@cmd}"
  system("chroot", @gentoo, "/bin/bash", "-c", "source /etc/profile && emerge --changed-use #{@cmd}")
  read_exit
end
run!() click to toggle source
# File lib/getch/command.rb, line 80
def run!
  @log.info "Running emerge: #{@cmd}"
  system("chroot", @gentoo, "/bin/bash", "-c", "source /etc/profile && #{@cmd}")
  read_exit
end

Private Instance Methods

read_exit() click to toggle source
# File lib/getch/command.rb, line 94
def read_exit
  if $?.exitstatus > 0
    @log.fatal "Running #{@cmd}"
  else
    @log.info "Done #{@cmd}"
  end
end