Class: Uberinstaller::Commander
- Inherits:
-
Object
- Object
- Uberinstaller::Commander
- Includes:
- Loggable
- Defined in:
- lib/uberinstaller/commander.rb
Overview
Execute user defined command before and after installation
Instance Attribute Summary collapse
-
#pkg ⇒ Object
Returns the value of attribute pkg.
-
#pkg_name ⇒ Object
readonly
The name of the package being processed.
Instance Method Summary collapse
-
#after ⇒ Object
Execute after installation command.
-
#before ⇒ Object
Execute after installation command.
-
#initialize(pkg_name, pkg) ⇒ Commander
constructor
Initialize the Commander class with the package information.
Methods included from Loggable
configure_logger_for, #logger, logger_for
Constructor Details
#initialize(pkg_name, pkg) ⇒ Commander
Initialize the Commander class with the package information
23 24 25 26 27 28 29 |
# File 'lib/uberinstaller/commander.rb', line 23 def initialize(pkg_name, pkg) @pkg_name = pkg_name @pkg = pkg @after_cmd_path = File.join Config.command_path, 'after' @before_cmd_path = File.join Config.command_path, 'before' end |
Instance Attribute Details
#pkg ⇒ Object
Returns the value of attribute pkg.
17 18 19 |
# File 'lib/uberinstaller/commander.rb', line 17 def pkg @pkg end |
#pkg_name ⇒ Object (readonly)
The name of the package being processed
17 18 19 |
# File 'lib/uberinstaller/commander.rb', line 17 def pkg_name @pkg_name end |
Instance Method Details
#after ⇒ Object
Execute after installation command
32 33 34 35 36 37 |
# File 'lib/uberinstaller/commander.rb', line 32 def after if @pkg.has_key? :cmd and @pkg[:cmd].has_key? :after logger.info "Executing after commands..." run :after end end |
#before ⇒ Object
Execute after installation command
40 41 42 43 44 45 |
# File 'lib/uberinstaller/commander.rb', line 40 def before if @pkg.has_key? :cmd and @pkg[:cmd].has_key? :before logger.info "Executing before commands..." run :before end end |