Module: Inprovise::CmdChannel
- Defined in:
- lib/inprovise/cmd_channel.rb
Overview
Command channel for Inprovise
- Author
-
Martin Corino
- License
-
Distributes under the same license as Ruby
Defined Under Namespace
Classes: Exception
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Class Method Summary collapse
- .default_implementation ⇒ Object
- .default_implementation=(impl) ⇒ Object
- .define(impl, base = ::Object, &definition) ⇒ Object
- .implementations ⇒ Object
- .open(node, impl) ⇒ Object
Instance Method Summary collapse
-
#close ⇒ Object
session management.
- #download(_from, _to) ⇒ Object
- #initialize(node) ⇒ Object
-
#run(_command, _forcelog = false) ⇒ Object
command execution (MANDATORY).
-
#upload(_from, _to) ⇒ Object
MANDATORY file management routines.
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
39 40 41 |
# File 'lib/inprovise/cmd_channel.rb', line 39 def node @node end |
Class Method Details
.default_implementation ⇒ Object
16 17 18 |
# File 'lib/inprovise/cmd_channel.rb', line 16 def default_implementation @default ||= 'ssh' end |
.default_implementation=(impl) ⇒ Object
20 21 22 |
# File 'lib/inprovise/cmd_channel.rb', line 20 def default_implementation=(impl) @default = impl end |
.define(impl, base = ::Object, &definition) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/inprovise/cmd_channel.rb', line 24 def define(impl, base=::Object, &definition) implklass = Class.new(base) do include Inprovise::CmdChannel end implklass.class_eval(&definition) implementations[impl.to_s] = implklass implklass end |
.implementations ⇒ Object
12 13 14 |
# File 'lib/inprovise/cmd_channel.rb', line 12 def implementations @implementations ||= {} end |
.open(node, impl) ⇒ Object
33 34 35 |
# File 'lib/inprovise/cmd_channel.rb', line 33 def open(node, impl) implementations[impl || default_implementation].new(node) end |
Instance Method Details
#close ⇒ Object
session management
47 48 49 |
# File 'lib/inprovise/cmd_channel.rb', line 47 def close # noop end |
#download(_from, _to) ⇒ Object
63 64 65 |
# File 'lib/inprovise/cmd_channel.rb', line 63 def download(_from, _to) raise RuntimeError, 'UNIMPLEMENTED' end |
#initialize(node) ⇒ Object
41 42 43 |
# File 'lib/inprovise/cmd_channel.rb', line 41 def initialize(node) @node = node end |
#run(_command, _forcelog = false) ⇒ Object
command execution (MANDATORY)
53 54 55 |
# File 'lib/inprovise/cmd_channel.rb', line 53 def run(_command, _forcelog=false) raise RuntimeError, 'UNIMPLEMENTED' end |
#upload(_from, _to) ⇒ Object
MANDATORY file management routines
59 60 61 |
# File 'lib/inprovise/cmd_channel.rb', line 59 def upload(_from, _to) raise RuntimeError, 'UNIMPLEMENTED' end |