Class: Siba::SibaTask

Inherits:
Object
  • Object
show all
Includes:
LoggerPlug
Defined in:
lib/siba/tasks/siba_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LoggerPlug

close, create, logger, #logger, opened?

Constructor Details

#initialize(options, category) ⇒ SibaTask

Returns a new instance of SibaTask.



9
10
11
12
13
14
15
# File 'lib/siba/tasks/siba_task.rb', line 9

def initialize(options, category)
  @category = category
  load Siba::SibaCheck.options_hash(options, category)
rescue
  logger.error "Failed to load #{category} plugin"
  raise
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



7
8
9
# File 'lib/siba/tasks/siba_task.rb', line 7

def category
  @category
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/siba/tasks/siba_task.rb', line 7

def options
  @options
end

#pluginObject

Returns the value of attribute plugin.



7
8
9
# File 'lib/siba/tasks/siba_task.rb', line 7

def plugin
  @plugin
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/siba/tasks/siba_task.rb', line 7

def type
  @type
end

Instance Method Details

#backup(*args) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/siba/tasks/siba_task.rb', line 17

def backup(*args)
  logger.debug "Running #{category}/#{type}"
  @plugin.backup *args
rescue Exception
  logger.error "Failed to backup #{category}/#{type}"
  raise
end

#restore(*args) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/siba/tasks/siba_task.rb', line 25

def restore(*args)
  logger.debug "Restoring #{category}/#{type}"
  @plugin.restore *args
rescue Exception
  logger.error "Failed to restore #{category}/#{type}"
  raise
end