Class: Yast::HooksClass::Hook

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
library/general/src/modules/Hooks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, caller_path, search_path) ⇒ Hook


155
156
157
158
159
160
161
162
# File 'library/general/src/modules/Hooks.rb', line 155

def initialize(name, caller_path, search_path)
  log.debug "Creating hook '#{name}' from '#{self.caller_path}'"
  search_path.verify!
  @search_path = search_path
  @name = name
  @files = find_hook_files(name).map { |path| HookFile.new(path) }
  @caller_path = caller_path.split(":in").first
end

Instance Attribute Details

#caller_pathObject (readonly)

Returns the value of attribute caller_path


153
154
155
# File 'library/general/src/modules/Hooks.rb', line 153

def caller_path
  @caller_path
end

#filesObject (readonly)

Returns the value of attribute files


153
154
155
# File 'library/general/src/modules/Hooks.rb', line 153

def files
  @files
end

#nameObject (readonly)

Returns the value of attribute name


153
154
155
# File 'library/general/src/modules/Hooks.rb', line 153

def name
  @name
end

#search_pathObject (readonly)

Returns the value of attribute search_path


153
154
155
# File 'library/general/src/modules/Hooks.rb', line 153

def search_path
  @search_path
end

Instance Method Details

#executeObject


164
165
166
167
# File 'library/general/src/modules/Hooks.rb', line 164

def execute
  Builtins.y2milestone "Executing hook '#{name}'"
  files.each(&:execute)
end

#failed?Boolean


181
182
183
# File 'library/general/src/modules/Hooks.rb', line 181

def failed?
  !succeeded?
end

#resultsObject


173
174
175
# File 'library/general/src/modules/Hooks.rb', line 173

def results
  files.map(&:result)
end

#succeeded?Boolean


177
178
179
# File 'library/general/src/modules/Hooks.rb', line 177

def succeeded?
  files.all?(&:succeeded?)
end

#used?Boolean


169
170
171
# File 'library/general/src/modules/Hooks.rb', line 169

def used?
  !files.empty?
end