Class: Kafo::Wizard

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

Instance Method Summary collapse

Constructor Details

#initialize(kafo) ⇒ Wizard

Returns a new instance of Wizard.



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

def initialize(kafo)
  @kafo   = kafo
  @config = kafo.config
  @name   = @config.app[:name] || 'Kafo'
  setup_terminal
  setup_colors
end

Instance Method Details

#runObject



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

def run
  message = "Welcome to the #{@name} installer!"
  HighLine.color(message, :important)
  say(HighLine.color(message, :headline))
  say(HighLine.color('-' * message.size, :horizontal_line))
  say(<<END)

This wizard will gather all required information. You can change any parameter to your needs.

END

  exit 0 unless agree("\n<%= color('Ready to start?', :question) %> (y/n)", false)

  main_menu
rescue Interrupt
  puts "Got interrupt, exiting"
  exit(0)
end