Class: Yast::HooksClass::HookFile
- Inherits:
-
Object
- Object
- Yast::HooksClass::HookFile
- Includes:
- Logger
- Defined in:
- ../../library/general/src/modules/Hooks.rb
Instance Attribute Summary (collapse)
-
- (Object) content
readonly
Returns the value of attribute content.
-
- (Object) path
readonly
Returns the value of attribute path.
-
- (Object) result
readonly
Returns the value of attribute result.
Instance Method Summary (collapse)
- - (Object) execute
- - (Boolean) failed?
-
- (HookFile) initialize(path)
constructor
A new instance of HookFile.
- - (Object) output
- - (Boolean) succeeded?
Constructor Details
- (HookFile) initialize(path)
Returns a new instance of HookFile
205 206 207 |
# File '../../library/general/src/modules/Hooks.rb', line 205 def initialize(path) @path = path end |
Instance Attribute Details
- (Object) content (readonly)
Returns the value of attribute content
203 204 205 |
# File '../../library/general/src/modules/Hooks.rb', line 203 def content @content end |
- (Object) path (readonly)
Returns the value of attribute path
203 204 205 |
# File '../../library/general/src/modules/Hooks.rb', line 203 def path @path end |
- (Object) result (readonly)
Returns the value of attribute result
203 204 205 |
# File '../../library/general/src/modules/Hooks.rb', line 203 def result @result end |
Instance Method Details
- (Object) execute
209 210 211 212 213 214 215 216 |
# File '../../library/general/src/modules/Hooks.rb', line 209 def execute log.info "Executing hook file '#{path}'" @result = OpenStruct.new(SCR.Execute(Path.new(".target.bash_output"), path.to_s)) if failed? log.error "Hook file '#{path.basename}' failed with stderr: #{result.stderr}" end result end |
- (Boolean) failed?
234 235 236 |
# File '../../library/general/src/modules/Hooks.rb', line 234 def failed? !succeeded? end |
- (Object) output
222 223 224 225 226 227 228 |
# File '../../library/general/src/modules/Hooks.rb', line 222 def output return "" unless result output = [] output << "STDERR: #{result.stderr.strip}" unless result.stderr.empty? output << "STDOUT: #{result.stdout.strip}" unless result.stdout.empty? output.join("; ") end |
- (Boolean) succeeded?
230 231 232 |
# File '../../library/general/src/modules/Hooks.rb', line 230 def succeeded? result.exit.zero? end |