Class: Kafo::Wizard

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

Constant Summary collapse

OK =
utf_support? ? '' : 'y'
NO =
utf_support? ? '' : 'n'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kafo) ⇒ Wizard

Returns a new instance of Wizard.



14
15
16
17
18
19
# File 'lib/kafo/wizard.rb', line 14

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

Class Method Details

.utf_support?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/kafo/wizard.rb', line 7

def self.utf_support?
  Kafo::ENV::LANG =~ /UTF-8\z/
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/kafo/wizard.rb', line 21

def run
  message = "Welcome to the #{@name} installer!"
  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"
  KafoConfigure.exit(130)
end