class Getch::States

Public Class Methods

new() click to toggle source
# File lib/getch/states.rb, line 5
def initialize
  @file = File.join('/tmp/install_gentoo.yaml')
  load_state
end

Public Instance Methods

config() click to toggle source
# File lib/getch/states.rb, line 30
def config
  STATES[:gentoo_config] = true
  save
end
format() click to toggle source
# File lib/getch/states.rb, line 15
def format
  STATES[:format] = true
  save
end
kernel() click to toggle source
# File lib/getch/states.rb, line 40
def kernel
  STATES[:gentoo_kernel] = true
  save
end
mount() click to toggle source
# File lib/getch/states.rb, line 20
def mount
  STATES[:mount] = true
  save
end
partition() click to toggle source
# File lib/getch/states.rb, line 10
def partition
  STATES[:partition] = true
  save
end
stage3() click to toggle source
# File lib/getch/states.rb, line 25
def stage3
  STATES[:gentoo_base] = true
  save
end
update() click to toggle source
# File lib/getch/states.rb, line 35
def update
  STATES[:gentoo_update] = true
  save
end

Private Instance Methods

load_state() click to toggle source
# File lib/getch/states.rb, line 51
def load_state()
  if File.exist? @file
    state_file = YAML.load_file(@file)
    STATES.merge!(state_file)
  else
    save
    STDERR.puts "Initialize states"
  end
end
save() click to toggle source
# File lib/getch/states.rb, line 47
def save
  File.open(@file, 'w') { |f| YAML::dump(STATES, f) }
end