class InfinumSetup::Program::Base

Attributes

name[R]
options[R]
settings[R]

Public Class Methods

new(name, settings, options) click to toggle source
# File lib/infinum_setup/program/base.rb, line 7
def initialize(name, settings, options)
  @name = name
  @settings = settings
  @options = options
end

Public Instance Methods

install() click to toggle source
# File lib/infinum_setup/program/base.rb, line 13
def install
  return unless will_install?
  puts
  prompt_pre_install_comment
  return if skip_install?
  prompt_installing
  execute_command
  prompt_post_install_comment
  execute_command(post_install_command) if post_install_command
end
install_if_not_interactive?() click to toggle source
# File lib/infinum_setup/program/base.rb, line 40
def install_if_not_interactive?
  settings['install_if_not_interactive']
end
mandatory?() click to toggle source
# File lib/infinum_setup/program/base.rb, line 36
def mandatory?
  settings['mandatory']
end
post_install_command() click to toggle source
# File lib/infinum_setup/program/base.rb, line 52
def post_install_command
  settings['post_install_command']
end
post_install_comment() click to toggle source
# File lib/infinum_setup/program/base.rb, line 48
def post_install_comment
  settings['post_install_comment']
end
pre_install_comment() click to toggle source
# File lib/infinum_setup/program/base.rb, line 44
def pre_install_comment
  settings['pre_install_comment']
end
valid?() click to toggle source
# File lib/infinum_setup/program/base.rb, line 31
def valid?
  return true if settings.keys.all? { |key| valid_keys.include?(key.to_sym) }
  raise "#{name} -- Settings are not correct"
end
valid_keys() click to toggle source
# File lib/infinum_setup/program/base.rb, line 24
def valid_keys
  [
    :mandatory, :pre_install_comment, :post_install_comment, :type,
    :install_if_not_interactive, :post_install_command
  ]
end

Private Instance Methods

command() click to toggle source
# File lib/infinum_setup/program/base.rb, line 58
def command
  raise NotImplementedError
end
prompt() click to toggle source
# File lib/infinum_setup/program/base.rb, line 62
def prompt
  @prompt ||= TTY::Prompt.new
end