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

Returns a new instance of Hook



152
153
154
155
156
157
158
159
# File 'library/general/src/modules/Hooks.rb', line 152

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



150
151
152
# File 'library/general/src/modules/Hooks.rb', line 150

def caller_path
  @caller_path
end

#filesObject (readonly)

Returns the value of attribute files



150
151
152
# File 'library/general/src/modules/Hooks.rb', line 150

def files
  @files
end

#nameObject (readonly)

Returns the value of attribute name



150
151
152
# File 'library/general/src/modules/Hooks.rb', line 150

def name
  @name
end

#resultsObject (readonly)

Returns the value of attribute results



150
151
152
# File 'library/general/src/modules/Hooks.rb', line 150

def results
  @results
end

#search_pathObject (readonly)

Returns the value of attribute search_path



150
151
152
# File 'library/general/src/modules/Hooks.rb', line 150

def search_path
  @search_path
end

Instance Method Details

#executeObject



161
162
163
164
# File 'library/general/src/modules/Hooks.rb', line 161

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

#failed?Boolean

Returns:

  • (Boolean)


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

def failed?
  !succeeded?
end

#succeeded?Boolean

Returns:

  • (Boolean)


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

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

#used?Boolean

Returns:

  • (Boolean)


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

def used?
  !files.empty?
end