Class: Uberinstaller::Installer
- Inherits:
-
Object
- Object
- Uberinstaller::Installer
- Includes:
- Loggable
- Defined in:
- lib/uberinstaller/installer.rb
Instance Method Summary collapse
-
#initialize(pkg_name, pkg_body) ⇒ Installer
constructor
Initialize the class.
-
#install(type) ⇒ Object
Perform package installation based upon installation type, only if installable? is true.
-
#installable? ⇒ bool
Return if the package is installable.
-
#preprocess(type) ⇒ Object
Perform package preprocessing based upon installation type, only if installable? is true.
-
#validate(type) ⇒ Object
Perform package validation based upon installation type.
Methods included from Loggable
configure_logger_for, #logger, logger_for
Constructor Details
#initialize(pkg_name, pkg_body) ⇒ Installer
Initialize the class
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/uberinstaller/installer.rb', line 18 def initialize(pkg_name, pkg_body) @name = pkg_name @body = pkg_body # an Hash containing private processing info for the class @meta = Hash.new @meta[:installable] = true if @body.has_key? :skip and @body[:skip] logger.warn "#{@name} has :skip option active, skipping " end end |
Instance Method Details
#install(type) ⇒ Object
Perform package installation based upon installation type, only if installable? is true
53 54 55 56 57 58 59 60 61 |
# File 'lib/uberinstaller/installer.rb', line 53 def install(type) return unless installable? case type when 'git' then install_git when 'local' then install_local when 'system' then install_system end end |
#installable? ⇒ bool
Return if the package is installable
34 35 36 |
# File 'lib/uberinstaller/installer.rb', line 34 def installable? @body[:skip] ? false : true end |
#preprocess(type) ⇒ Object
Perform package preprocessing based upon installation type, only if installable? is true
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/uberinstaller/installer.rb', line 66 def preprocess(type) return unless installable? case type when 'git' then preprocess_git when 'local' then preprocess_local when 'system' then preprocess_system when 'json' then preprocess_json else raise Exception::NoPreprocessorException, type end end |
#validate(type) ⇒ Object
Perform package validation based upon installation type
41 42 43 44 45 46 47 48 |
# File 'lib/uberinstaller/installer.rb', line 41 def validate(type) case type when 'system' then validate_system when 'git' then validate_git when 'local' then validate_local when 'json' then validate_json end end |