Class: GrimReaper::ShellModule
- Inherits:
-
Object
- Object
- GrimReaper::ShellModule
- Defined in:
- lib/grim_reaper/shell_module.rb
Overview
Shell module wrapper for sh_grim operations
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#grim_root ⇒ Object
readonly
Returns the value of attribute grim_root.
Instance Method Summary collapse
- #execute(command, *args) ⇒ Object
-
#initialize(config, grim_root) ⇒ ShellModule
constructor
A new instance of ShellModule.
- #status ⇒ Object
Constructor Details
#initialize(config, grim_root) ⇒ ShellModule
Returns a new instance of ShellModule.
10 11 12 13 |
# File 'lib/grim_reaper/shell_module.rb', line 10 def initialize(config, grim_root) @config = config @grim_root = grim_root end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/grim_reaper/shell_module.rb', line 8 def config @config end |
#grim_root ⇒ Object (readonly)
Returns the value of attribute grim_root.
8 9 10 |
# File 'lib/grim_reaper/shell_module.rb', line 8 def grim_root @grim_root end |
Instance Method Details
#execute(command, *args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/grim_reaper/shell_module.rb', line 15 def execute(command, *args) case command when "backup" execute_backup(*args) when "restore" execute_restore(*args) when "monitor" execute_monitor(*args) when "scan" execute_scan(*args) when "security" execute_security(*args) else execute_generic(command, *args) end end |
#status ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/grim_reaper/shell_module.rb', line 32 def status { status: "ready", module: "shell", available_commands: %w[backup restore monitor scan security], grim_root: @grim_root } end |