class Bixby::Provision::RunControl

Constants

EXPORTS

Public Instance Methods

first_boot(&block) click to toggle source
# File lib/bixby/provision/dsl/run_control.rb, line 9
def first_boot(&block)
  if first_boot_has_run? then
    logger.info "first_boot already ran"
    return
  end

  logger.info "running first_boot block"
  begin
    block.call
  rescue Exception => ex
    # TODO fail!
    raise ex
    return
  end

  touch_first_boot_state
end

Private Instance Methods

first_boot_has_run?() click to toggle source
# File lib/bixby/provision/dsl/run_control.rb, line 30
def first_boot_has_run?
  File.exists?(first_boot_state)
end
first_boot_state() click to toggle source
# File lib/bixby/provision/dsl/run_control.rb, line 34
def first_boot_state
  Bixby.path("var", "provision", "first_boot")
end
touch_first_boot_state() click to toggle source
# File lib/bixby/provision/dsl/run_control.rb, line 38
def touch_first_boot_state
  f = first_boot_state
  FileUtils.mkdir_p(File.dirname(f))
  FileUtils.touch(f)
end