Class: InfinumSetup::Program::Base
- Inherits:
-
Object
- Object
- InfinumSetup::Program::Base
show all
- Includes:
- Helpers
- Defined in:
- lib/infinum_setup/program/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Helpers
#execute, #execute_command, #install_question, #prompt_installing, #prompt_post_install_comment, #prompt_pre_install_comment, #simulate, #skip_install?, #will_install?
Constructor Details
#initialize(name, settings, options) ⇒ Base
Returns a new instance of Base.
7
8
9
10
11
|
# File 'lib/infinum_setup/program/base.rb', line 7
def initialize(name, settings, options)
@name = name
@settings = settings
@options = options
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5
6
7
|
# File 'lib/infinum_setup/program/base.rb', line 5
def name
@name
end
|
#options ⇒ Object
Returns the value of attribute options.
5
6
7
|
# File 'lib/infinum_setup/program/base.rb', line 5
def options
@options
end
|
#settings ⇒ Object
Returns the value of attribute settings.
5
6
7
|
# File 'lib/infinum_setup/program/base.rb', line 5
def settings
@settings
end
|
Instance Method Details
#install ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/infinum_setup/program/base.rb', line 13
def install
return unless will_install?
puts
return if skip_install?
prompt_installing
execute_command
execute_command(post_install_command) if post_install_command
end
|
#install_if_not_interactive? ⇒ Boolean
40
41
42
|
# File 'lib/infinum_setup/program/base.rb', line 40
def install_if_not_interactive?
settings['install_if_not_interactive']
end
|
#mandatory? ⇒ Boolean
36
37
38
|
# File 'lib/infinum_setup/program/base.rb', line 36
def mandatory?
settings['mandatory']
end
|
#post_install_command ⇒ Object
52
53
54
|
# File 'lib/infinum_setup/program/base.rb', line 52
def post_install_command
settings['post_install_command']
end
|
48
49
50
|
# File 'lib/infinum_setup/program/base.rb', line 48
def
settings['post_install_comment']
end
|
44
45
46
|
# File 'lib/infinum_setup/program/base.rb', line 44
def
settings['pre_install_comment']
end
|
#valid? ⇒ Boolean
31
32
33
34
|
# 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 ⇒ Object
24
25
26
27
28
29
|
# 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
|