Class: Jisota::PackageScript
- Inherits:
-
Object
- Object
- Jisota::PackageScript
- Defined in:
- lib/jisota/package_script.rb
Overview
Part of the Script duck type
Executes an entire package, which in turn might execute other packages. The args are parsed with the ParamParser to match args with params.
If the package has a verify_block, that will be executed first. If the result of verify is success, the run_block will not be executed.
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#package ⇒ Object
Returns the value of attribute package.
Instance Method Summary collapse
- #execute(context) ⇒ Object
-
#initialize(package, args = []) ⇒ PackageScript
constructor
A new instance of PackageScript.
- #to_s ⇒ Object
Constructor Details
#initialize(package, args = []) ⇒ PackageScript
Returns a new instance of PackageScript.
13 14 15 16 |
# File 'lib/jisota/package_script.rb', line 13 def initialize(package, args = []) @package = package @args = args end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
11 12 13 |
# File 'lib/jisota/package_script.rb', line 11 def args @args end |
#package ⇒ Object
Returns the value of attribute package.
11 12 13 |
# File 'lib/jisota/package_script.rb', line 11 def package @package end |
Instance Method Details
#execute(context) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/jisota/package_script.rb', line 18 def execute(context) context.param_scope(parse_params) do context.logger.("Package #{self}") do execute_package(context) end end end |
#to_s ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/jisota/package_script.rb', line 26 def to_s result = "" result << package.name.to_s if args.any? result << " " result << args.map(&:inspect).join(", ") end result end |